Skip to content

Commit 9c5b383

Browse files
strenuous-lifejianglong3Yunnglin
authored
print request id (#1242)
* print request id In order to facilitate the identification of backend issues, such as sglang, the request_id should be printed. Signed-off-by: jianglong3 <jianglong3@kingsoft.com> * update --------- Signed-off-by: jianglong3 <jianglong3@kingsoft.com> Co-authored-by: jianglong3 <jianglong3@kingsoft.com> Co-authored-by: Yunnglin <mao.looper@qq.com>
1 parent 3a83299 commit 9c5b383

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

evalscope/api/model/model_output.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def from_content(cls, content: Union[str, List[Content]]) -> 'ChatCompletionChoi
129129
class ModelOutput(BaseModel):
130130
"""Output from model generation."""
131131

132+
id: Optional[str] = Field(default=None)
133+
"""Completion ID."""
134+
132135
model: str = Field(default_factory=str)
133136
"""Model used for generation."""
134137

evalscope/models/openai_compatible.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def generate(
9999
# handle streaming response
100100
if not isinstance(completion, ChatCompletion):
101101
completion = collect_stream_response(completion)
102+
102103
response = completion.model_dump()
103104
self.on_response(response)
104105

evalscope/models/utils/anthropic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ def model_output_from_anthropic(
376376
)
377377

378378
return ModelOutput(
379+
id=message.id,
379380
model=message.model,
380381
choices=choices,
381382
usage=ModelUsage(

evalscope/models/utils/openai.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ def model_output_from_openai(
511511
choices: list[ChatCompletionChoice],
512512
) -> ModelOutput:
513513
return ModelOutput(
514+
id=completion.id,
514515
model=completion.model,
515516
choices=choices,
516517
usage=(

0 commit comments

Comments
 (0)