From 5d1bb1f9e472af084d8755db36a70354492244f4 Mon Sep 17 00:00:00 2001 From: Oleksandr Kozachuk Date: Fri, 10 Nov 2023 10:42:46 +0100 Subject: [PATCH] Fix some of the commands. --- chatmastermind/ais/openai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chatmastermind/ais/openai.py b/chatmastermind/ais/openai.py index e3ce5a6..7e28032 100644 --- a/chatmastermind/ais/openai.py +++ b/chatmastermind/ais/openai.py @@ -68,6 +68,7 @@ class OpenAI(AI): self.ID = config.ID self.name = config.name self.config = config + openai.api_key = self.config.api_key def request(self, question: Message, @@ -80,7 +81,6 @@ class OpenAI(AI): nr. of messages in the 'AIResponse'. """ self.encoding = tiktoken.encoding_for_model(self.config.model) - openai.api_key = self.config.api_key oai_chat, prompt_tokens = self.openai_chat(chat, self.config.system, question) tokens: Tokens = Tokens(prompt_tokens, 0, prompt_tokens) response = openai.ChatCompletion.create(