[gRPC] Move runtime.v1 bindings to tonic 0.14, report OpenAI status codes, return text on request (#42673)

Co-authored-by: Kan Wu <kan.wu@radixark.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kan Wu
2026-10-13 13:46:15 -07:00
committed by GitHub
co-authored by Kan Wu Claude Opus 5.5
parent 18210ed849
commit 79af3df346
6 changed files with 54 additions and 12 deletions
+3 -1
View File
@@ -12,6 +12,7 @@ import logging
from types import SimpleNamespace
from typing import Any, Awaitable, Callable, Dict, List, Optional
from fastapi.encoders import jsonable_encoder
from pydantic import ValidationError
from sglang.srt.arg_groups.overrides import resolving_view
@@ -798,7 +799,8 @@ class RuntimeHandle:
elif hasattr(result, "body"):
resp_bytes = result.body
elif isinstance(result, (dict, list)):
resp_bytes = json.dumps(result).encode("utf-8")
# As FastAPI encodes it over HTTP; rerank returns a list of models.
resp_bytes = json.dumps(jsonable_encoder(result)).encode("utf-8")
else:
resp_bytes = str(result).encode("utf-8")
status_code = int(