Chat
BaseChat
Bases: ABC
Base class for chat models.
__init__(config)
Initialize the chat model with the given configuration.
Parameters:
-
config
(BaseChatConfig
) –Configuration for the chat model.
chat(messages)
abstractmethod
async
Asynchronously process the messages and return the generated response.
Parameters:
-
messages
(List[Any]
) –A list of messages to process.
Returns:
-
str
–The generated response.
OpenAIChat
Bases: BaseChat
, RetryMixin
Implementation of BaseChat for OpenAI models.
__init__(llm_manager, config)
Initialize the OpenAIChat with the provided LLM manager and configuration.
Parameters:
-
llm_manager
(OpenAIManager
) –Manager for OpenAI LLM interactions.
-
config
(OpenAIChatConfig | Dict | str | Path
) –Configuration for OpenAI chat.
chat(messages)
async
Asynchronously process the messages and return the generated response.
Parameters:
-
messages
(List[ChatCompletionMessageParam]
) –List of messages for chat completion.
Returns:
-
str
–The generated response.
Raises:
-
RetryError
–If retry attempts are exhausted.
-
Exception
–For any unexpected errors during processing.