Repository navigation
fix: skip seed for Gemini when api_base has no trailing slash - #600
Open
fermibubble wants to merge 1 commit into
Open
fermibubble wants to merge 1 commit into
fermibubble wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gemini's OpenAI-compatible endpoint rejects
seed(Invalid JSON payload received. Unknown name "seed", see #105), soOpenAILLMskips it there. The check comparesapi_baseto the exact stringhttps://generativelanguage.googleapis.com/v1beta/openai/, though, so the same URL without the trailing slash still sendsseed. With the defaultrandom_seed: 42, every call then fails, and the log only saysError code: 400because 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 skippedapi_base: ".../v1beta/openai":All 1 attempts failed with error: Error code: 400Changes:
generativelanguage.googleapis.com) instead of the exact URLTests: 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.