Skip to content

feat: Better support for tools_strict=True when using the OpenAIChatGenerator #9411

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
sjrl opened this issue May 20, 2025 · 0 comments · May be fixed by #9382
Open

feat: Better support for tools_strict=True when using the OpenAIChatGenerator #9411

sjrl opened this issue May 20, 2025 · 0 comments · May be fixed by #9382

Comments

@sjrl
Copy link
Contributor

sjrl commented May 20, 2025

Is your feature request related to a problem? Please describe.
Currently when a user specifies tools_strict=True when using the OpenAIChatGenerator we only update the provided tool_schema in a basic way. Namely setting strict=True and additionalProperties=False at the top-level of the tools schema.

This puts the majority of the effort on providing a strict compliant tool schema on the user when creating their tools. This isn't great if our users are relying on the automatic tool schema generation we provide in create_tool_from_function and in ComponentTool.

A prominent example is when ChatMessage ends up in the tool parameter schema. It's by default not strict compliant so would cause an OpenAI error if tools_strict=True is passed at run time.

Describe the solution you'd like
Update our tools_strict=True functionality to do a best effort at making the user-provided schema strict compliant. I don't expect we will be able to cover every scenario but at least being able to cover some common examples of types in our component run methods would be nice if they are ever converted into a tool using ComponentTool.

I've started work in this PR #9382 but it's become more involved than I thought to support something like ChatMessage and I don't currently have the time to finish it.

Additional context
A prominent example of this will be when users create Agent tools using ComponentTool + Agent. Agent has List[ChatMessage] in its run method so if users also want to use tools_strict=True they would have to manually create the parameters schema of this tool or they would get an OpenAI error if they tried to use our auto generated schema.

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 a pull request may close this issue.

1 participant