Bind tool-like objects to this chat model.
A list of tool definitions to bind to this chat model.
Can be a pydantic model, Callable, or BaseTool. Pydantic models,
Callable, and BaseTool objects will be automatically converted to
their schema dictionary representation.
Tools with Union types in their arguments are now supported and
converted to anyOf schemas.
Control how the model uses tools.
Options:
'auto' (default): Model decides whether to call functions'any' or 'required': Model must call a function (both are
equivalent)'none': Model cannot call functions'function_name': Model must call the specified function['fn1', 'fn2']: Model must call one of the specified functionsTrue: Same as 'any'Can be used together with tool_config to control function calling
while also providing additional configuration like retrieval_config.
Any additional parameters to pass to the Runnable constructor.
Optional tool configuration for additional settings like
retrieval_config (for Google Maps/Google Search grounding).
Can be used together with tool_choice, but cannot specify
function_calling_config in tool_config if tool_choice is also
provided (they would conflict).
from langchain_google_genai import ChatGoogleGenerativeAI
model = ChatGoogleGenerativeAI(model="gemini-2.5-pro")
response = model.invoke(
"What Italian restaurants are near here?",
tools=[{"google_maps": {}}],
tool_choice="required",
tool_config={
"retrieval_config": {
"lat_lng": {
"latitude": 48.858844,
"longitude": 2.294351,
}
}
},
)