langchain-ai / langchain-google

MIT License
111 stars 138 forks source link

tool_choice doesnt work on gemini-1.5-flash but works on gemini-1.5-pro #440

Open HiraveBapu opened 2 months ago

HiraveBapu commented 2 months ago

model = llm.bind_tools(tools=tools,tool_choice="add")

error: Retrying langchain_google_vertexai.chat_models._acompletion_with_retry.._completion_with_retry_inner in 10.0 seconds as it raised InvalidArgument: 400 Request contains an invalid argument.

langchain-google-vertexai = "^1.0.8" langchain-core = "^0.2.32"

lkuligin commented 2 months ago

The tool configuration's ANY mode ("forced function calling") is supported for Gemini 1.5 Pro models only.

https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#tool-config

efriis commented 2 months ago

@lkuligin maybe it's worth not retrying and instead passing through the error for this class of error? The error message could also probably be improved

itsparser commented 1 month ago

anyone working on this issue