Repository navigation
[gRPC] Serialize list results of native OpenAI RPCs as over HTTP - #42680
Closed
sherlockwu wants to merge 1 commit into
Closed
sherlockwu wants to merge 1 commit into
sherlockwu wants to merge 1 commit into
Conversation
Rerank returns a list of RerankResponse models, which json.dumps rejects, so the native gRPC Rerank answered "Object of type RerankResponse is not JSON serializable". Encode dict and list results with jsonable_encoder, as FastAPI does for the HTTP route. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sherlockwu
requested review from
CatherineSue,
JustinTong0323,
ispobock,
merrymercy and
slin1237
as code owners
October 5, 2026 23:27
Collaborator
Author
|
Folded into #42673 (same engine-side gRPC fix and test). |
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.
Motivation
The native gRPC
RerankRPC always fails with{"error": {"message": "Object of type RerankResponse is not JSON serializable"}}. Rerank returns a list ofRerankResponsemodels, and the gRPC bridge passes that list straight tojson.dumps. Over HTTP, FastAPI encodes the same list withjsonable_encoder, so the HTTP route works.Changes
RuntimeHandle._run_openai_requestnow encodes dict and list results withjsonable_encoderbeforejson.dumps, as FastAPI does for the HTTP route.Tests
test/registered/unit/entrypoints/test_grpc_bridge.pyfails without the fix and passes with it.--grpc-port): the native gRPCReranknow returns exactly the HTTP/v1/rerankbody.CI States
Latest PR Test (Base): ❌ Run #37388640141
Latest PR Test (Extra): ❌ Run #37389058807
Latest PR Test (AMD ROCm 10): ❌ Run #37388639936