diff --git a/infrastructure/openai/__init__.py b/infrastructure/chatgpt/__init__.py similarity index 100% rename from infrastructure/openai/__init__.py rename to infrastructure/chatgpt/__init__.py diff --git a/infrastructure/openai/openai_client.py b/infrastructure/chatgpt/chatgpt.py similarity index 89% rename from infrastructure/openai/openai_client.py rename to infrastructure/chatgpt/chatgpt.py index 34af4290..ee2a5b39 100644 --- a/infrastructure/openai/openai_client.py +++ b/infrastructure/chatgpt/chatgpt.py @@ -6,10 +6,10 @@ from typing import Optional from openai import OpenAI from openai.types.chat import ChatCompletionMessageParam -from infrastructure.openai.exceptions import OpenAiClientError +from infrastructure.chatgpt.exceptions import ChatGPTClientError -class OpenAiChatClient: +class ChatGPT: """Thin wrapper over the OpenAI Chat Completions API. Sends a single prompt and returns the assistant's reply as plain text. @@ -24,7 +24,7 @@ class OpenAiChatClient: ) -> None: key = api_key or os.environ.get("OPENAI_API_KEY") if not key: - raise OpenAiClientError( + raise ChatGPTClientError( "No OpenAI API key provided. " "Pass api_key or set the OPENAI_API_KEY environment variable." ) @@ -56,5 +56,5 @@ class OpenAiChatClient: ) content = response.choices[0].message.content if content is None: - raise OpenAiClientError("OpenAI returned an empty response.") + raise ChatGPTClientError("ChatGPT returned an empty response.") return content diff --git a/infrastructure/openai/exceptions.py b/infrastructure/chatgpt/exceptions.py similarity index 54% rename from infrastructure/openai/exceptions.py rename to infrastructure/chatgpt/exceptions.py index 14cf95a2..31663f3d 100644 --- a/infrastructure/openai/exceptions.py +++ b/infrastructure/chatgpt/exceptions.py @@ -1,2 +1,2 @@ -class OpenAiClientError(Exception): +class ChatGPTClientError(Exception): """Base for all OpenAI client errors."""