fix(lite_llm): exclude llm_client from model_dump to fix build_graph …#5375
Open
ammarfitwalla wants to merge 1 commit intogoogle:mainfrom
Open
fix(lite_llm): exclude llm_client from model_dump to fix build_graph …#5375ammarfitwalla wants to merge 1 commit intogoogle:mainfrom
ammarfitwalla wants to merge 1 commit intogoogle:mainfrom
Conversation
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.
1. Link to an existing issue (if applicable):
Testing Plan
Unit Tests:
Added
test_lite_llm_model_dump_excludes_llm_clientintests/unittests/models/test_litellm.py.This test asserts that
llm_clientis absent frommodel_dump(mode="python", exclude_none=True)output.246 passed, 1 warning in 6.15s
Manual End-to-End (E2E) Tests:
Unable to perform E2E testing at this time due to lack of a LiteLLM-compatible API key.
The unit test directly covers the root cause —
llm_clientbeing present inmodel_dump()output — which is the exact field that causes thePydanticSerializationErrorin the builder serialization path.Checklist
Additional context
The builder endpoint in
adk_web_server.pyserializes agent fields viamodel_dump().For
LiteLlm, this includedllm_client-- aLiteLLMClientinstance that Pydanticcannot serialize, causing:
pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize
unknown type: <class 'google.adk.models.lite_llm.LiteLLMClient'>
Fix: Mark
llm_clientwithexclude=Truein its PydanticFielddefinition.This drops it from
model_dump()output while keeping the client fully functional at runtime.