Open tonyabracadabra opened 1 month ago
I found a similar issue that might be relevant to your problem: No tools_call in message error on ChatVertexAI. This issue was closed, and the solution involved ensuring that the input message and schema were correctly aligned with the expected output from the model [1].
To resolve the "No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser" error, ensure that the generations
array passed to the parseResult
method contains messages with a tool_calls
property that is an array. Here is an example of how the generations
array should be structured:
const generations = [
{
message: {
tool_calls: [
{
args: {
// your tool call arguments here
}
}
]
}
}
];
Make sure your input data is correctly formatted to include the necessary tool_calls
array [2].
To continue talking to Dosu, mention @dosu.
Does this persist with larger models? What if you prompt more strictly to include something like "you must always use tools if available"?
Unfortunately tool calling/structured output isn't perfect in all cases - CC @bracesproul to make sure we're doing all we can here.
Does this persist with larger models? What if you prompt more strictly to include something like "you must always use tools if available"?
Unfortunately tool calling/structured output isn't perfect in all cases - CC @bracesproul to make sure we're doing all we can here.
I don't understand, I am just using it for structured output without requiring it to use any tools.
hey there - running into the same issue and I believe it's because withStructuredOutput
does not call llm.bind with the tool_choice
param that @bracesproul added here: https://github.com/langchain-ai/langchainjs/pull/6195/files.
Also relevant is that it looks like "forced function calling" support with "mode: any" was only recently added for Gemini Flash: https://github.com/google-gemini/generative-ai-js/issues/190. I don't think a change is needed specifically to support flash, but would be great if we could update withStructuredOutput
to use forced function calling! Currently withStructuredOutput is unusable at least for me.
I think just accepting a param for tool_choice
would work - could have an option that automatically sets tool_choice to the explicitly defined the function name, but since there's only one function setting it to "any" should always work.
Hi there! We are a group of 3 students from the University of Toronto and we are very interested in fixing this issue and also adding some tests. We will submit a PR for this issue by end of November.
Yes please! Will assign it to you @BaharChidem.
We are running into the same issue. If there is anything we can help with, let me know.
I have switched to vercel's generateObject, life is so much easier now!
Any update on this issue? Thanks
@tonyabracadabra could you send me an example zod schema that will trigger this error?
@tonyabracadabra could you send me an example zod schema that will trigger this error?
I believe any zod schema would trigger this if no tools were specified somewhere within
We are continuing to work on the issue and hope to have a PR up by the end of next week. We are currently just finding difficulties with replicating the issue in our Linux VMs, but hope to get this resolved soon. Thanks!
@BaharChidem thanks a lot!
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
When attempting to generate structured output using Google's Generative AI (Gemini) through LangChain, an error occurs: CopyError: No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser. Context
The error occurs when using the ChatGoogleGenerativeAI class from @langchain/google-genai. The code is attempting to use structured output with a Zod schema. The model being used is "gemini-1.5-flash".
System Info
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.5.0: Wed May 1 20:17:33 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6031 Available memory (MB): 98304 Available CPU cores: 14 Binaries: Node: 20.11.1 npm: 10.2.4 Yarn: N/A pnpm: 9.6.0 Relevant Packages: next: 15.0.0-canary.160 // There is a newer canary version (15.0.0-canary.173) available, please upgrade! eslint-config-next: 15.0.0-canary.69 react: 19.0.0-rc-778e1ed2-20240926 react-dom: 19.0.0-rc-778e1ed2-20240926 typescript: 5.6.2 Next.js Config: output: N/A