Skip to content

Commit 1ab925e

Browse files
authored
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
1 parent 301df11 commit 1ab925e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

astrbot/core/provider/sources/gemini_source.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ async def _prepare_query_config(
215215
]
216216

217217
tool_config = None
218-
if tools and tool_list:
218+
has_func_decl = tool_list and any(t.function_declarations for t in tool_list)
219+
if has_func_decl:
219220
tool_config = types.ToolConfig(
220221
function_calling_config=types.FunctionCallingConfig(
221222
mode=(

0 commit comments

Comments
 (0)