diff --git a/.github/workflows/code-integration.yml b/.github/workflows/code-integration.yml index d393f0a..acdf301 100644 --- a/.github/workflows/code-integration.yml +++ b/.github/workflows/code-integration.yml @@ -4,7 +4,7 @@ on: push: branches: - main - - dev + - fix/docker jobs: test: diff --git a/src/utils/chatgpt_communicator.py b/src/utils/chatgpt_communicator.py index 8065b33..8324d86 100644 --- a/src/utils/chatgpt_communicator.py +++ b/src/utils/chatgpt_communicator.py @@ -4,8 +4,6 @@ from dotenv import load_dotenv load_dotenv() -client = OpenAI() - class ChatGPTCommunicator: """ @@ -23,6 +21,7 @@ def __init__(self, api_key=None, language_model="gpt-4"): self.api_key = api_key or os.getenv("OPENAI_API_KEY") self.language_model = language_model self.messages = [{"role": "system", "content": "You are a helpful assistant."}] + self.client = OpenAI(api_key=self.api_key) def create_chat(self, initial_message): @@ -62,7 +61,7 @@ def get_response(self): raise ValueError("Chat not initialized. Call create_chat() first.") try: - response = client.chat.completions.create(model=self.language_model, + response = self.client.chat.completions.create(model=self.language_model, messages=self.messages) # Directly accessing the content of the message from the response if response.choices and hasattr(response.choices[0].message, 'content'):