From 5132c35d2eb70318b295919c158545bec8fc20c9 Mon Sep 17 00:00:00 2001 From: lucaferrario Date: Fri, 15 Mar 2024 10:41:14 +0100 Subject: [PATCH] fix(openai): rolled back response parsing for chat model --- keybert/llm/_openai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keybert/llm/_openai.py b/keybert/llm/_openai.py index 1cdf4ae8..f5c0bdc0 100644 --- a/keybert/llm/_openai.py +++ b/keybert/llm/_openai.py @@ -178,7 +178,7 @@ def extract_keywords(self, documents: List[str], candidate_keywords: List[List[s response = chat_completions_with_backoff(self.client, **kwargs) else: response = self.client.chat.completions.create(**kwargs) - keywords = response.choices[0].text.strip() + keywords = response.choices[0].message.content.strip() # Use a non-chat model else: