Skip to content

Commit 91b73bf

Browse files
authored
Fix for non streaming clients (#967)
* Fix for non-non streaming clients Fixes bug that that returned improper json for non-streaming clients. This fix corrects also ensures that the chat requests and responses are persisted properly for display in codegate admin UI. * Fix for non-streaming clients Fixes that returned improper json for non-streaming clients. This fix corrects also ensures that the chat requests and responses are persisted properly for display in codegate admin UI.
1 parent 1bee357 commit 91b73bf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/codegate/providers/formatting/input_pipeline.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import AsyncIterator, Union
33

44
from litellm import ModelResponse
5-
from litellm.types.utils import Delta, StreamingChoices
5+
from litellm.types.utils import Choices, Delta, Message, StreamingChoices
66

77
from codegate.db.connection import DbRecorder
88
from codegate.pipeline.base import PipelineContext, PipelineResponse
@@ -56,7 +56,12 @@ def _create_model_response(
5656
else:
5757
return ModelResponse(
5858
id=response_id,
59-
choices=[{"text": content, "index": 0, "finish_reason": None}],
59+
# choices=[{"text": content, "index": 0, "finish_reason": None}],
60+
choices=[
61+
Choices(
62+
message=Message(content=content, role="assistant"),
63+
)
64+
],
6065
created=created,
6166
model=model,
6267
)

0 commit comments

Comments
 (0)