diff --git a/.env.example b/.env.example index 4ead17f..3021cda 100644 --- a/.env.example +++ b/.env.example @@ -14,7 +14,7 @@ REDIS_URL=redis://localhost:6379/0 # LLM Provider Configuration # Supported providers: "gemini", "openai", "fake" LLM_PROVIDER=gemini -LLM_MODEL=gemini-2.0-flash +LLM_MODEL=gemini-3.7-flash GEMINI_API_KEY=your_gemini_api_key_here OPENAI_API_KEY=your_openai_api_key_here diff --git a/agentkit/config.py b/agentkit/config.py index 1121ada..7ebe44f 100644 --- a/agentkit/config.py +++ b/agentkit/config.py @@ -32,7 +32,7 @@ class Settings(BaseSettings): description="LLM provider: gemini, openai, or fake.", ) LLM_MODEL: str = Field( - default="gemini-2.0-flash", + default="gemini-3.7-flash", description="LLM model identifier.", ) GEMINI_API_KEY: str | None = Field( diff --git a/agentkit/llm/factory.py b/agentkit/llm/factory.py index 56168d5..4de7918 100644 --- a/agentkit/llm/factory.py +++ b/agentkit/llm/factory.py @@ -38,7 +38,7 @@ def create_llm_client( normalized_provider = provider.strip().lower() if normalized_provider == "gemini": - default_model = model or "gemini-2.0-flash" + default_model = model or "gemini-3.7-flash" return GeminiClient(api_key=api_key, model=default_model, **kwargs) if normalized_provider == "openai": diff --git a/agentkit/llm/gemini.py b/agentkit/llm/gemini.py index d9815a6..b0dc6fe 100644 --- a/agentkit/llm/gemini.py +++ b/agentkit/llm/gemini.py @@ -18,14 +18,14 @@ class GeminiClient(LLMClient): def __init__( self, api_key: str | None = None, - model: str = "gemini-2.0-flash", + model: str = "gemini-3.7-flash", client: Any | None = None, ) -> None: """Initialize the Gemini client adapter. Args: api_key: Gemini API key. If omitted, google-genai attempts ADC/env lookup. - model: Gemini model identifier (default: gemini-2.0-flash). + model: Gemini model identifier (default: gemini-3.7-flash). client: Optional pre-configured genai.Client instance (useful for mocking). """ self.model = model @@ -107,7 +107,7 @@ async def chat( ) contents.append( types.Content( - role="tool", + role="user", parts=[ types.Part.from_function_response( name=tool_name, diff --git a/docker-compose.yml b/docker-compose.yml index 701ba51..d743b0e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,7 +76,7 @@ services: # Compose keeps ${VAR:-} so `down`, `ps` and `logs` still work without it. - API_KEYS=${API_KEYS:-} - LLM_PROVIDER=${LLM_PROVIDER:-gemini} - - LLM_MODEL=${LLM_MODEL:-gemini-2.0-flash} + - LLM_MODEL=${LLM_MODEL:-gemini-3.7-flash} - GEMINI_API_KEY=${GEMINI_API_KEY:-} - OPENAI_API_KEY=${OPENAI_API_KEY:-} volumes: diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index f06845d..05d4b56 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -14,7 +14,7 @@ def test_default_settings() -> None: API_KEYS="key1,key2", ) assert settings.LLM_PROVIDER == "gemini" - assert settings.LLM_MODEL == "gemini-2.0-flash" + assert settings.LLM_MODEL == "gemini-3.7-flash" assert settings.MAX_STEPS == 10 assert settings.RUN_TIMEOUT_S == 60 assert settings.TOOL_TIMEOUT_S == 15 diff --git a/tests/unit/test_gemini_adapter.py b/tests/unit/test_gemini_adapter.py index 1dc9d9d..495e650 100644 --- a/tests/unit/test_gemini_adapter.py +++ b/tests/unit/test_gemini_adapter.py @@ -126,6 +126,9 @@ async def test_gemini_multi_turn_history_translation(mock_genai_client: MagicMoc response = await adapter.chat(messages) assert response.text == "Result is 25." assert mock_genai_client.aio.models.generate_content.called + _, kwargs = mock_genai_client.aio.models.generate_content.call_args + contents = kwargs["contents"] + assert contents[2].role == "user" @pytest.mark.asyncio @@ -192,15 +195,15 @@ async def test_gemini_thought_signature_capture_and_forward(mock_genai_client: M assert model_part.function_call.name == "calculator" assert model_part.thought_signature == b"opaque_thought_sig_xyz" - # Tool message must have role="tool" and function_response name resolved to "calculator" + # Tool message must have role="user" and function_response name resolved to "calculator" tool_content = contents[2] - assert tool_content.role == "tool" + assert tool_content.role == "user" tool_part = tool_content.parts[0] assert tool_part.function_response.name == "calculator" assert tool_part.function_response.response == {"result": "4"} def test_gemini_default_model(mock_genai_client: MagicMock) -> None: - """Verify GeminiClient defaults to gemini-2.0-flash.""" + """Verify GeminiClient defaults to gemini-3.7-flash.""" adapter = GeminiClient(api_key="fake-key", client=mock_genai_client) - assert adapter.model == "gemini-2.0-flash" + assert adapter.model == "gemini-3.7-flash" diff --git a/tests/unit/test_llm_factory.py b/tests/unit/test_llm_factory.py index 2f4afc9..aacb779 100644 --- a/tests/unit/test_llm_factory.py +++ b/tests/unit/test_llm_factory.py @@ -26,6 +26,10 @@ def test_create_gemini_client() -> None: assert client.model == "gemini-2.5-pro" assert client.api_key == "test-key-gemini" + client_default = create_llm_client(provider="gemini", api_key="test-key-gemini") + assert isinstance(client_default, GeminiClient) + assert client_default.model == "gemini-3.7-flash" + def test_create_openai_client() -> None: client = create_llm_client(