-
Notifications
You must be signed in to change notification settings - Fork 6k
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. |
* doc: Enrich AssistantAgent API documentation with usage examples. (microsoft#5653) Resolves microsoft#5562 * remove dep on aspire - add google.protobuf (microsoft#5645) <!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> removes unneeded deps ## Related issue number <!-- For example: "Closes microsoft#1234" --> Closes microsoft#5644 ## Checks - [ ] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed. * [dotnet] Add mixin for easier state save/load apis (microsoft#5438) Co-authored-by: Ryan Sweet <[email protected]> * Replace the undefined tools variable with tool_schema parameter in ToolUseAgent class (microsoft#5684) Replace the undefined `tools` variable with `tool_schema` parameter <!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? This change keeps the documentation up to date : https://microsoft.github.io/autogen/stable//user-guide/core-user-guide/components/tools.html <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes microsoft#1234" --> ## Checks - [ ] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [x] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed. * Improve readme inconsistency (microsoft#5691) ### Before <img width="823" alt="image" src="https://github.com/user-attachments/assets/d5ba1671-9433-4fa4-9884-c0de6fafb82e" /> ### After <img width="803" alt="image" src="https://github.com/user-attachments/assets/07fdd32a-d2ad-450d-8b7f-b21f10f14c85" /> * pack agenthost as tool (microsoft#5647) <!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? convenience - allows to just run "agenthost" ``` dotnet pack --no-build --configuration Release --output './output/release' -bl\n dotnet tool install --add-source ./output/release Microsoft.AutoGen.AgentHost agenthost ``` <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes microsoft#1234" --> closes microsoft#5646 ## Checks - [ ] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed. * update versions to 0.4.8 (microsoft#5689) * Update issue templates (microsoft#5686) * doc & sample: Update documentation for human-in-the-loop and UserProxyAgent; Add UserProxyAgent to ChainLit sample; (microsoft#5656) Resolves microsoft#5610 And address various questions regarding to how to use user proxy agent and human-in-the-loop. * doc: Update SelectorGroupChat doc on how to use O3-mini model. (microsoft#5657) Resolves microsoft#5408 Co-authored-by: Jack Gerrits <[email protected]> * Add metadata field to basemessage (microsoft#5372) Add metadata field to BaseMessage. Why? - additional metadata field can track 1) timestamp if needed, 2) flags about the message. For instance, a use case is a metadata field {"internal":"yes"} that would hide messages from being displayed in an application or studio. As long as an extra field is added to basemessage that is not consumed by existing agents, I am happy. Notes: - We can also only add it to BaseChatMessage, that would be fine - I don't care what the extra field is called as long as there is an extra field somewhere - I don't have preference for the type, a str could work, but a dict would be more useful. --------- Co-authored-by: Eric Zhu <[email protected]> * Change base image to one with arm64 support (microsoft#5681) --------- Co-authored-by: Eric Zhu <[email protected]> Co-authored-by: Ryan Sweet <[email protected]> Co-authored-by: Jack Gerrits <[email protected]> Co-authored-by: Shubham Shukla <[email protected]> Co-authored-by: gagb <[email protected]> Co-authored-by: Hussein Mozannar <[email protected]>
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: