autogen
autogen copied to clipboard
What is the current way to export an thread and preload a chat with a team in v0.4
I'm fairly new to the AutoGen project and we're exploring it for our use case, but as I was prototyping it in a notebook I was wondering what is the way for us to be able to export a chat and preload it in a team. For example:
team = SelectorGroupChat(
participants=[customer_service_agent, manager_agent, finance_agent],
allow_repeated_speaker=False,
model_client=OpenAIChatCompletionClient(model="gpt-4o"),
)
I can do this to get the conversation history
conversation = await team.run(task="Hello I would like a refund!")
print(conversation.messages)
But I would love to be able to export it as JSON
import json
conversation = await team.run(task="Hello I would like a refund!")
print(json.dumps(conversation.messages))
And equally I would love to be able to import the conversation history JSON so anything ran against in team.run()
conversation_history = json.loads(conversation_history_json)
conversation = await team.run(conversation=conversation_history, task="Hi world!")
Also, is it possible to message the agents with nothing (ideally as a specific flag)? We would love to be able to have agents give a meaningful intro message, but this isn't critical - we can build workarounds for this.
Note that this is for the v0.4 release!