-
Notifications
You must be signed in to change notification settings - Fork 122
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
withStructuredOutput does not accept tools #755
Comments
Thanks for the issue! What would be the expected behavior here? |
Using withStructuredOutput(outputSchema, config) {
....
llm = this.bind({
tools: [
{
type: "function",
function: {
name: functionName,
description: asJsonSchema.description,
parameters: asJsonSchema,
},
},
],
tool_choice: {
type: "function",
function: {
name: functionName,
},
},
// Do not pass `strict` argument to OpenAI if `config.strict` is undefined
...(config?.strict !== undefined ? { strict: config.strict } : {}),
});
...
} The expected behavior is allow the llm to call the bind tools. |
So it would either return a tool message or structured output? |
My ideia is to have the structured output, but, if I need to call some tool receive the |
Let me explain better. I'm implementing a multi agent experiment, using the I loved the Command idea with the json object as return, made the life easier for me. Thank you for that! On my project each agent will have access to some tools. On my tests, when I use I work arround calling OpenAi library directly, with What do you think? |
Hi Jacob, I really need this functionality! LLM should return a tool call (AI Message calling a tool) or Structured Output. Do you know if this is in progress, or planned to be implemented? |
It's not super straightforward/generalizable - best bet at the moment is to attach a |
When using
withStructuredOutput
, the tools bind to the llm are ignored.If we add a
tools
to the structured schema as a workaround it almost never works as expected.On the
invoke
method, if it's awithStructuredOutput
it will declare just one tool, to force the model to call a parser method to the response.Could be a way to use
withStructuredOutput
with custom tools as well.The text was updated successfully, but these errors were encountered: