From 23c5640ee891b0820760ecd2536e98355c65330a Mon Sep 17 00:00:00 2001 From: Siddharth Venkatesan Date: Fri, 19 Jul 2024 15:05:48 -0700 Subject: [PATCH] [chat-completions] fix minor issues with response schema --- engines/python/setup/djl_python/output_formatter.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/engines/python/setup/djl_python/output_formatter.py b/engines/python/setup/djl_python/output_formatter.py index a53419c00..46561453e 100644 --- a/engines/python/setup/djl_python/output_formatter.py +++ b/engines/python/setup/djl_python/output_formatter.py @@ -277,13 +277,9 @@ def _json_chat_output_formatter(request_output: RequestOutput): "role": "assistant", "content": generated_text, }, + "logprobs": None, "finish_reason": best_sequence.finish_reason, } - response1 = { - "id": f"chatcmpl-{id}", - "object": "chat.completion", - "created": created, - } if parameters.get("logprobs"): logprobs = { "content": [ @@ -310,7 +306,7 @@ def _json_chat_output_formatter(request_output: RequestOutput): "total_tokens": (prompt_tokens + completion_tokens) } result = { - "id": f"chatcmpl-{id}", + "id": f"chatcmpl-{id(request_output)}", "object": "chat.completion", "created": created, "choices": [choice], @@ -358,7 +354,7 @@ def _jsonlines_chat_output_formatter(request_output: RequestOutput): "finish_reason": best_sequence.finish_reason } response = { - "id": f"chatcmpl-{id}", + "id": f"chatcmpl-{id(request_output)}", "object": "chat.completion.chunk", "created": created, "choices": [choice] # Currently only support 1 choice