ToolConfig(
function_calling_config: vertexai.generative_models._generative_models.ToolConfig.FunctionCallingConfig,
)
Config shared for all tools provided in the request.
Usage: Create ToolConfig
tool_config = ToolConfig(
function_calling_config=ToolConfig.FunctionCallingConfig(
mode=ToolConfig.FunctionCallingConfig.Mode.ANY,
allowed_function_names=["get_current_weather_func"],
))
```
Use ToolConfig in `GenerativeModel.generate_content`:
```
model = GenerativeModel("gemini-pro")
print(model.generate_content(
"What is the weather like in Boston?",
# You can specify tools when creating a model to avoid having to send them with every request.
tools=[weather_tool],
tool_config=tool_config,
))
```
Use ToolConfig in chat:
```
model = GenerativeModel(
"gemini-pro",
# You can specify tools when creating a model to avoid having to send them with every request.
tools=[weather_tool],
tool_config=tool_config,
)
chat = model.start_chat()
print(chat.send_message("What is the weather like in Boston?"))
print(chat.send_message(
Part.from_function_response(
name="get_current_weather",
response={
"content": {"weather_there": "super nice"},
}
),
))
```