autointent.generation.Generator#
- class autointent.generation.Generator(base_url=None, model_name=None, **generation_params)#
Wrapper class for accessing OpenAI API.
- Parameters:
base_url (str | None) – HTTP-endpoint for sending API requests to OpenAI API compatible server. Omit this to infer
OPENAI_BASE_URL
from environment.model_name (str | None) – Name of LLM. Omit this to infer
OPENAI_MODEL_NAME
from environment.**generation_params (Any) – kwargs that will be sent with a request to the endpoint.
- model_name = None#
- client#
- async_client#
- generation_params#
- get_chat_completion(messages)#
Prompt LLM and return its answer.
- Parameters:
messages (list[autointent.generation.chat_templates.Message]) – List of messages to send to the model.
- Return type:
- async get_chat_completion_async(messages)#
Prompt LLM and return its answer asynchronously.
- Parameters:
messages (list[autointent.generation.chat_templates.Message]) – List of messages to send to the model.
- Return type: