renamed to chatgpt

This commit is contained in:
Jun-te Kim 2026-05-22 14:07:10 +00:00
parent 675aa089c9
commit c887153292
3 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -1,2 +1,2 @@
class OpenAiClientError(Exception):
class ChatGPTClientError(Exception):
"""Base for all OpenAI client errors."""