From f1f58ea1a24a62c70260ecbdb36b79b3fd7536e0 Mon Sep 17 00:00:00 2001 From: KyrianC Date: Fri, 27 Oct 2023 10:54:55 +0200 Subject: [PATCH] [fix] KeyError handling chat response --- edenai_apis/apis/openai/openai_text_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edenai_apis/apis/openai/openai_text_api.py b/edenai_apis/apis/openai/openai_text_api.py index a304e247..dd3b2ec1 100644 --- a/edenai_apis/apis/openai/openai_text_api.py +++ b/edenai_apis/apis/openai/openai_text_api.py @@ -705,7 +705,7 @@ def text__chat( # Standardize the response if stream is False: - generated_text = response["choices"][0]["delta"]["content"] + generated_text = response["choices"][0]["message"]["content"] message = [ ChatMessageDataClass(role="user", message=text), ChatMessageDataClass(role="assistant", message=generated_text),