Skip to content

Commit 49cedbd

Browse files
fix: reponse format JSONSchema key fix (#427)
* fix: reponse format JSONSchema key fix * fix * update --------- Co-authored-by: Aniket Maurya <theaniketmaurya@gmail.com>
1 parent ccc322a commit 49cedbd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/litserve/specs/openai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class ResponseFormatJSONObject(BaseModel):
117117
class JSONSchema(BaseModel):
118118
name: str
119119
description: Optional[str] = None
120-
schema_def: Optional[Dict[str, object]] = Field(None, alias="schema")
120+
schema_: Optional[Dict[str, object]] = Field(None, alias="schema")
121121
strict: Optional[bool] = False
122122

123123

@@ -405,7 +405,7 @@ async def streaming_completion(self, request: ChatCompletionRequest, pipe_respon
405405
usage_info = sum(usage_infos)
406406
chunk = ChatCompletionChunk(model=model, choices=choices, usage=None)
407407
logger.debug(chunk)
408-
yield f"data: {chunk.model_dump_json()}\n\n"
408+
yield f"data: {chunk.model_dump_json(by_alias=True)}\n\n"
409409

410410
choices = [
411411
ChatCompletionStreamingChoice(
@@ -420,7 +420,7 @@ async def streaming_completion(self, request: ChatCompletionRequest, pipe_respon
420420
choices=choices,
421421
usage=usage_info,
422422
)
423-
yield f"data: {last_chunk.model_dump_json()}\n\n"
423+
yield f"data: {last_chunk.model_dump_json(by_alias=True)}\n\n"
424424
yield "data: [DONE]\n\n"
425425

426426
async def non_streaming_completion(self, request: ChatCompletionRequest, generator_list: List[AsyncGenerator]):

0 commit comments

Comments
 (0)