Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for structured output mode in AgentChat #5043

Open
BenConstable9 opened this issue Jan 14, 2025 · 3 comments
Open

Support for structured output mode in AgentChat #5043

BenConstable9 opened this issue Jan 14, 2025 · 3 comments
Milestone

Comments

@BenConstable9
Copy link

What feature would you like to be added?

Support for open ai structured output mode in agent chat. The ability to give an agent a Pydantic class that it must adhere to in the response.

This could be dumped to json as a message for intermediate agents?

Why is this needed?

This would make integrating AutoGen with api requests easier. e.g. consider an answer agent at the end of a complex agentic group chat. It might need to formulate the answer in a specific json format, once it takes into account all the previous messages.

OpenAI structured data mode makes the likelihood of a correct JSON structure far more likely than prompting alone.

@rysweet
Copy link
Collaborator

rysweet commented Jan 14, 2025

thanks @BenConstable9

@rysweet
Copy link
Collaborator

rysweet commented Jan 14, 2025

@ekzhu - I feel like this has been discussed recently - is there another relevant issue?

@ekzhu
Copy link
Collaborator

ekzhu commented Jan 14, 2025

There was a PR a while back that add the response format option to model client. It is already available for OpenAIChatCompletionClient and AzureOpenAIChatCompletionClient.

https://microsoft.github.io/autogen/stable/user-guide/core-user-guide/cookbook/structured-output-agent.html

So a fix can be to add response_format parameter to AssistantAgent, and it accepts a Pydantic type.

@ekzhu ekzhu added this to the 0.4.x milestone Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants