Skip to content

fix(litellm): forward GenerateContentConfig.seed to LiteLLM - #6516

Open
chelsealong wants to merge 1 commit into
google:mainfrom
chelsealong:fix/litellm-forward-seed
Open

fix(litellm): forward GenerateContentConfig.seed to LiteLLM#6516
chelsealong wants to merge 1 commit into
google:mainfrom
chelsealong:fix/litellm-forward-seed

Conversation

@chelsealong

Copy link
Copy Markdown

Summary

GenerateContentConfig(seed=...) was silently dropped by LiteLlm — the seed
stayed in the request config but never reached the parameters passed to
LiteLLM.

The cause is in _get_completion_inputs (src/google/adk/models/lite_llm.py):
generation parameters are extracted by iterating over a fixed allowlist of keys
(temperature, max_output_tokens, top_p, top_k, stop_sequences,
presence_penalty, frequency_penalty), and seed was not in that list.
LiteLLM supports seed natively (see
https://docs.litellm.ai/docs/completion/input), so the one-line fix adds it to
the forwarded parameters.

Closes #6513

Testing Plan

Extended the existing test_get_completion_inputs_generation_params unit test
to set seed=42 and assert generation_params["seed"] == 42.

Proof the test guards the fix (stash source change, run test, restore):

  • Without the fix: assert generation_params["seed"] == 42
    KeyError: 'seed' (1 failed)
  • With the fix: 1 passed

Full suite for the touched module:

$ pytest tests/unittests/models/test_litellm.py -q
356 passed, 5 warnings

Lint: pyink --check, isort --check-only, and ruff check all pass on the
changed files.

Note

This PR was prepared with AI assistance (Claude). The fix, the test, and the
test evidence above were reviewed for correctness before submitting.

@google-cla

google-cla Bot commented Jul 30, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@adk-bot adk-bot added the models [Component] This issue is related to model support label Jul 30, 2026
@chelsealong
chelsealong force-pushed the fix/litellm-forward-seed branch from 4f3196e to c0e2e7a Compare July 30, 2026 03:15
@chelsealong

Copy link
Copy Markdown
Author

@googlebot I signed it!

@chelsealong
chelsealong force-pushed the fix/litellm-forward-seed branch from c0e2e7a to 9d63543 Compare July 30, 2026 03:27
@chelsealong

Copy link
Copy Markdown
Author

@googlebot I signed it!

`seed` was absent from the generation-parameter allowlist in
`_get_completion_inputs`, so `GenerateContentConfig(seed=...)` was
silently dropped and never reached LiteLLM (which supports `seed`
natively). Add `seed` to the forwarded params.

Closes google#6513
@chelsealong
chelsealong force-pushed the fix/litellm-forward-seed branch from 07de3af to cd093e5 Compare July 30, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models [Component] This issue is related to model support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LiteLLM silently drops GenerateContentConfig.seed

3 participants