-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Document structured output for for AssistantAgent in its API doc, and note strict=True
is required for FunctionTool
#5562
Comments
You can pass the client with structured output into the agent, which will then generate structured output: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/agents.html#structured-output Make sure your FunctionTool is set to |
response_format
parameter support for AssistantAgentstrict=True
is required for FunctionTool
@ekzhu , It would be different right if the For example, if a user says "hello", then the output should be just "hello" instead of enforcing structured outputs. |
@ekzhu , """ |
This is indeed a bug in the model client. Can you create a separate issue for this? Open AI's client uses a different api for structure output. I think the create_stream method has not been updated to use it. |
How does one know when to use structured outputs and when not to? The model cannot decide this. When you pass in a base model in the response format in create method, it will still enforce the structure output. So it becomes the same thing as passing response format in the client which gets passed into the agent. Perhaps some dynamic approach to detect user intent and then decide whether to use structured output is possible. However, the AssistantAgent is already quite complex and if we add more complex behaviour it will become confusing. |
Exactly. First, detect intents and then dynamically decide if Any tips or example implementations if this would not be included in AssistantAgent ? |
Yes. I will create a new issue for this.
|
I think this can be a great idea for a custom agent that is meant to be a multi-purpose agent. Or, perhaps a selector group chat with dynamic routing based on user's intent. |
What feature would you like to be added?
Current AssistantAgent does not support
response_format
for structured output.extra_create_args={ "response_format": "Pydantic model", }
It would be perfect if
respose_format
can be supported by bothon_messages
andon_messages_stream
.Why is this needed?
It is a good feature supported by many models to return structured output. It would simplify integration with other application in cases where predefined structures are expected from AssistantAgent.
It seems it is supported by
OpenAIChatCompletionClient
The text was updated successfully, but these errors were encountered: