Repository navigation
Conversation
Fixes google#6164 LiteLlm stores its client as a Pydantic field which has no JSON serializer. Any JSON dump of a LiteLlm therefore raises `PydanticSerializationError`, which surfaces as a 500 in `adk web` / `adk api_server` whenever a LiteLlm reaches a response payload. Ether provider (Gemini, Anthropic, Apigee) keeps its client off the model as a @cached_property, so it is never serialized. LiteLlm intentionally exposes llm_client as an injectable field for testing, so rather than convert it, mark it `exclude=True` — the client is dropped from serialization while remaining constructible and unchanged at runtime. Testing: - pytest tests/unittests/models/test_litellm.py (all pass)
|
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. |
|
@claud42 can you sign the CLA? |
|
@wuliang229 I submitted the CLA immediately after created this PR. Not sure how long it would take to be approved or synchronized here though. |
|
@wuliang229 The CLA check has passed. |
|
@wuliang229 and @GWeale This PR has been pending to review/approval for quite a while. If anything further from my end is needed to move it forward, please let me know. Thx! |
|
The PR is included as part of ecbefd9. |
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
LiteLlm stores its client as a Pydantic field which has no JSON serializer. Any JSON dump of a LiteLlm therefore raises
PydanticSerializationError, which surfaces as a 500 inadk web/adk api_serverwhenever a LiteLlm reaches a response payload.Solution:
Ether provider (Gemini, Anthropic, Apigee) keeps its client off the model as a
@cached_property, so it is never serialized. LiteLlm intentionally exposes llm_client as an injectable field for testing, so rather than convert it, mark itexclude=True— the client is dropped from serialization while remaining constructible and unchanged at runtime.Testing Plan
Unit Tests:
pytest tests/unittests/models/test_litellm.py (all pass)
Manual End-to-End (E2E) Tests:
Code and commands to re-produce the issue was provided in original issue ticket.
The problem resolved end to end with this fix.
Checklist