Skip to content

fix: skip seed for Gemini when api_base has no trailing slash - #600

Open
fermibubble wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
fermibubble:skip-gemini-seed
Open

fermibubble wants to merge 1 commit into
algorithmicsuperintelligence:mainfrom
fermibubble:skip-gemini-seed

Conversation

@fermibubble

Copy link
Copy Markdown

Gemini's OpenAI-compatible endpoint rejects seed (Invalid JSON payload received. Unknown name "seed", see #105), so OpenAILLM skips it there. The check compares api_base to the exact string https://generativelanguage.googleapis.com/v1beta/openai/, though, so the same URL without the trailing slash still sends seed. With the default random_seed: 42, every call then fails, and the log only says Error code: 400 because the OpenAI client can't read Gemini's error body. Against the live API with gemini-2.5-flash-lite:

  • api_base: ".../v1beta/openai/": works, seed skipped
  • api_base: ".../v1beta/openai": All 1 attempts failed with error: Error code: 400

Changes:

  • match on the host (generativelanguage.googleapis.com) instead of the exact URL
  • log the "Skipping seed parameter" warning once per model instead of before every request. A 40-iteration run printed it 40 times.

Tests: new tests/test_openai_seed.py, 2 of its 3 tests fail on main. Full suite (python -m unittest discover -s tests -p "test_*.py"): 1079 OK, 7 skipped.

Gemini's OpenAI-compatible endpoint rejects seed (Invalid JSON payload received. Unknown name "seed", see algorithmicsuperintelligence#105), so OpenAILLM skips it there. The check compared api_base to the exact URL with a trailing slash, so the same URL without one still sent seed, and with the default random_seed every call failed with a bare "Error code: 400". Match on the host instead, and log the skip warning once per model rather than before every request.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant