From decf8c29911067398588e261c21597803b4f2bf3 Mon Sep 17 00:00:00 2001 From: Jai Amin Date: Fri, 13 Oct 2023 16:54:49 -0400 Subject: [PATCH] Fix bug relating to keyword extraction chain --- rest/clients/openai.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rest/clients/openai.py b/rest/clients/openai.py index 86f2dd2..49ca274 100644 --- a/rest/clients/openai.py +++ b/rest/clients/openai.py @@ -92,6 +92,8 @@ def keywords_extraction(self, user_input: str, model: str = "gpt-3.5-turbo"): ) chain = create_extraction_chain(schema, llm) keywords_extracted = list(chain.run(user_input)) + if any(isinstance(item, str) for item in keywords_extracted): + keywords_extracted = [{key: ""} for key in schema["properties"]] return self.prepare_keywords_for_semantic_search(keywords_extracted)