mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-10-25 09:52:11 +08:00
fix: skip FunctionCallingConfig when only native tools are present (#7407)
* fix: skip FunctionCallingConfig when only native tools are present When native tools (google_search, url_context) are enabled without any function_declarations, _prepare_query_config was still creating a FunctionCallingConfig, which makes Gemini API return 400 INVALID_ARGUMENT. Now we only set tool_config when tool_list actually contains function_declarations. Fixes #7406 * style: ruff format
This commit is contained in:
@@ -215,7 +215,8 @@ class ProviderGoogleGenAI(Provider):
|
||||
]
|
||||
|
||||
tool_config = None
|
||||
if tools and tool_list:
|
||||
has_func_decl = tool_list and any(t.function_declarations for t in tool_list)
|
||||
if has_func_decl:
|
||||
tool_config = types.ToolConfig(
|
||||
function_calling_config=types.FunctionCallingConfig(
|
||||
mode=(
|
||||
|
||||
Reference in New Issue
Block a user