Skip to content

Enhance output_content_type detection in AssistantAgent. #6732

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

smalltalkman
Copy link

Why are these changes needed?

Enhance output_content_type checking in AssistantAgent to prevent illegal types from being used to construct StructuredMessage.
This will also allow setting output_content_type=True on the AssistantAgent to output JSON output instead of json code blocks.

Related issue number

Closes #6727

Checks

@ekzhu
Copy link
Collaborator

ekzhu commented Jun 30, 2025

Thanks. Maybe we should validate the type in the constructor instead?

@smalltalkman
Copy link
Author

Maybe we should validate the type in the constructor instead?

The current modification focuses on the compatibility of output_content_type with json_output. So that json_output=True can be passed by setting output_content_type=True.

If strong validation of type is required in the constructor, I think the constructor interface should be modified to use json_output directly (currently output_content_type is mainly used for json_output). This is beyond the scope of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow models that only support json_object to also support structured output
2 participants