From 068ee0ac5eee6d87bcfe68fbb140cf3fd3e015ea Mon Sep 17 00:00:00 2001 From: Saba Date: Sun, 4 Jun 2023 02:25:08 -0700 Subject: [PATCH] Swap elif with else, as usage of this method does not use openai_api_key --- src/khoj/processor/conversation/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/processor/conversation/utils.py b/src/khoj/processor/conversation/utils.py index 8f0aa2ce..5ea5817c 100644 --- a/src/khoj/processor/conversation/utils.py +++ b/src/khoj/processor/conversation/utils.py @@ -43,7 +43,7 @@ def completion_with_backoff(**kwargs): prompt = kwargs.pop("prompt") if "api_key" in kwargs: kwargs["openai_api_key"] = kwargs.get("api_key") - elif "openai_api_key" not in kwargs: + else: kwargs["openai_api_key"] = os.getenv("OPENAI_API_KEY") llm = OpenAI(**kwargs, request_timeout=10, max_retries=1) return llm(prompt)