Skip to content

[gRPC] Serialize list results of native OpenAI RPCs as over HTTP - #42680

Closed
sherlockwu wants to merge 1 commit into
mainfrom
grpc-rerank-serialization
Closed

sherlockwu wants to merge 1 commit into
mainfrom
grpc-rerank-serialization

Conversation

@sherlockwu

@sherlockwu sherlockwu commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

The native gRPC Rerank RPC always fails with {"error": {"message": "Object of type RerankResponse is not JSON serializable"}}. Rerank returns a list of RerankResponse models, and the gRPC bridge passes that list straight to json.dumps. Over HTTP, FastAPI encodes the same list with jsonable_encoder, so the HTTP route works.

Changes

RuntimeHandle._run_openai_request now encodes dict and list results with jsonable_encoder before json.dumps, as FastAPI does for the HTTP route.

Tests

  • A new unit test in test/registered/unit/entrypoints/test_grpc_bridge.py fails without the fix and passes with it.
  • Real engine (Qwen3-Reranker-0.6B, --grpc-port): the native gRPC Rerank now returns exactly the HTTP /v1/rerank body.

CI States

Latest PR Test (Base): ❌ Run #37388640141
Latest PR Test (Extra): ❌ Run #37389058807
Latest PR Test (AMD ROCm 10): ❌ Run #37388639936

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

Copy link
Copy Markdown
Collaborator Author

Folded into #42673 (same engine-side gRPC fix and test).

@sherlockwu sherlockwu closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant