fix(rag): use router for completion in RAG query pipeline - #19550
Merged
1 commit merged intoJan 24, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
The RAG query endpoint was failing with "Object of type Router is not JSON serializable" when called through the proxy. This was caused by two issues: 1. The Router object passed via kwargs was leaking into the request payload sent to providers like Bedrock, causing JSON serialization errors. 2. The RAG query pipeline was calling litellm.acompletion() directly instead of using the router, so virtual model names configured in the proxy weren't being resolved to actual provider model IDs. This fix: - Extracts the router from kwargs and uses router.acompletion() when available, falling back to litellm.acompletion() otherwise - Adds "Router" to the list of non-serializable types in filter_exceptions_from_params as a defensive measure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
marcosgriselli
commented
Jan 22, 2026
| # Skip known non-serializable object types (Logging, Router, etc.) | ||
| obj_type_name = type(data).__name__ | ||
| if obj_type_name in ["Logging", "LiteLLMLoggingObj"]: | ||
| if obj_type_name in ["Logging", "LiteLLMLoggingObj", "Router"]: |
Contributor
Author
There was a problem hiding this comment.
Open to more guidance if this is not the right route but Router hits this issue
This was referenced Jan 23, 2026
ghost
merged commit Jan 24, 2026
6b1ce4e
into
BerriAI:litellm_oss_staging_01_24_2026
5 of 7 checks passed
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
) The RAG query endpoint was failing with "Object of type Router is not JSON serializable" when called through the proxy. This was caused by two issues: 1. The Router object passed via kwargs was leaking into the request payload sent to providers like Bedrock, causing JSON serialization errors. 2. The RAG query pipeline was calling litellm.acompletion() directly instead of using the router, so virtual model names configured in the proxy weren't being resolved to actual provider model IDs. This fix: - Extracts the router from kwargs and uses router.acompletion() when available, falling back to litellm.acompletion() otherwise - Adds "Router" to the list of non-serializable types in filter_exceptions_from_params as a defensive measure
7 tasks
This pull request was closed.
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.
Summary
The RAG query endpoint (
/v1/rag/query) was failing withObject of type Router is not JSON serializablewhen called through the proxy. This fix addresses two related issues:Router serialization error: The Router object passed via kwargs was leaking into the request payload sent to providers like Bedrock, causing JSON serialization errors.
Model name resolution: The RAG query pipeline was calling
litellm.acompletion()directly instead of using the router, so virtual model names configured in the proxy weren't being resolved to actual provider model IDs.Tested RAG query endpoint with Bedrock and OpenAI providers through the proxy