[agents] Use dedicated GOOGLE_AI_API_KEY for Gemini agent provider
Some checks failed
ci / test (push) Has been cancelled
ci / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-07-31 09:50:02 -04:00
parent 66fa555f63
commit 668570188a
4 changed files with 10 additions and 8 deletions

View File

@ -125,7 +125,7 @@ def test_opencode_agent_prompt_no_text_output():
def test_gemini_agent_prompt(settings):
settings.GOOGLE_API_KEY = "test-key"
settings.GOOGLE_AI_API_KEY = "test-key"
settings.LLM_MODEL = "gemini-2.5-flash"
fake = MagicMock()
fake.raise_for_status = MagicMock()
@ -147,13 +147,13 @@ def test_gemini_agent_prompt(settings):
def test_gemini_agent_prompt_missing_key(settings):
settings.GOOGLE_API_KEY = ""
with pytest.raises(ValueError, match="VROBBLER_GOOGLE_API_KEY is not set"):
settings.GOOGLE_AI_API_KEY = ""
with pytest.raises(ValueError, match="VROBBLER_GOOGLE_AI_API_KEY is not set"):
gemini_agent_prompt("hi")
def test_gemini_agent_prompt_bad_response(settings):
settings.GOOGLE_API_KEY = "test-key"
settings.GOOGLE_AI_API_KEY = "test-key"
fake = MagicMock()
fake.raise_for_status = MagicMock()
fake.json.return_value = {"unexpected": True}
@ -163,7 +163,7 @@ def test_gemini_agent_prompt_bad_response(settings):
def test_gemini_agent_prompt_with_history(settings):
settings.GOOGLE_API_KEY = "test-key"
settings.GOOGLE_AI_API_KEY = "test-key"
fake = MagicMock()
fake.raise_for_status = MagicMock()
fake.json.return_value = {"candidates": [{"content": {"parts": [{"text": "12"}]}}]}
@ -211,7 +211,7 @@ def test_agent_prompt_unknown_provider(settings):
def test_agent_prompt_defaults_to_configured_provider(settings):
settings.AGENT_PROVIDER = "gemini"
settings.GOOGLE_API_KEY = "test-key"
settings.GOOGLE_AI_API_KEY = "test-key"
with patch("agents.providers.gemini_agent_prompt", return_value={"text": "x"}) as m:
agent_prompt("hi")
m.assert_called_once_with("hi", history=None)