Skip to content
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

Open
TiagoGouvea opened this issue Dec 22, 2024 · 0 comments
Open

withStructuredOutput does not accept tools #755

TiagoGouvea opened this issue Dec 22, 2024 · 0 comments

Comments

@TiagoGouvea
Copy link

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 a withStructuredOutput it will declare just one tool, to force the model to call a parser method to the response.

  const llm = new ChatOpenAI({ modelName: 'gpt-4o-mini' });
  llm.bindTools(tools}; // these tools will be ignored
  const llmResult = await llm
    .withStructuredOutput(outputSchema, { name: 'Response' })
    .invoke(messages);

Could be a way to use withStructuredOutput with custom tools as well.

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

No branches or pull requests

1 participant