Skip to content

Commit 3460c49

Browse files
Fix google-genai function calling (#18933)
1 parent 73e07e4 commit 3460c49

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llama-index-integrations/llms/llama-index-llms-google-genai/llama_index/llms/google_genai/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def _prepare_chat_with_tools(
395395
) -> Dict[str, Any]:
396396
"""Predict and call the tool."""
397397
if tool_choice is None:
398-
tool_choice = "any" if tool_required else "none"
398+
tool_choice = "any" if tool_required else "auto"
399399

400400
if tool_choice == "auto":
401401
tool_mode = types.FunctionCallingConfigMode.AUTO

llama-index-integrations/llms/llama-index-llms-google-genai/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dev = [
2727

2828
[project]
2929
name = "llama-index-llms-google-genai"
30-
version = "0.2.0"
30+
version = "0.2.1"
3131
description = "llama-index llms google genai integration"
3232
authors = [{name = "Your Name", email = "[email protected]"}]
3333
requires-python = ">=3.9,<4.0"

llama-index-integrations/llms/llama-index-llms-google-genai/tests/test_llms_google_genai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def test_prepare_chat_with_tools_tool_not_required(
455455

456456
assert (
457457
result["tool_config"].function_calling_config.mode
458-
== types.FunctionCallingConfigMode.NONE
458+
== types.FunctionCallingConfigMode.AUTO
459459
)
460460
assert len(result["tools"]) == 1
461461
assert result["tools"][0].function_declarations[0].name == "search_tool"
@@ -470,7 +470,7 @@ def test_prepare_chat_with_tools_default_behavior(
470470

471471
assert (
472472
result["tool_config"].function_calling_config.mode
473-
== types.FunctionCallingConfigMode.NONE
473+
== types.FunctionCallingConfigMode.AUTO
474474
)
475475
assert len(result["tools"]) == 1
476476
assert result["tools"][0].function_declarations[0].name == "search_tool"

0 commit comments

Comments
 (0)