get_model

Returns the language model that this LLM is using.

Should be one of ["gpt-4", "gpt-4-0613", "gpt-4-32k", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613"]

get_messages

Returns the list of messages in OpenAI message format.

get_max_retries

Returns the maximum number of retries for this LLM when handling errors.

get_retry_delay

Returns the number of seconds to wait before retrying when handling errors.

get_rate_limit_delay

Returns the number of seconds to wait before retrying when handling rate limit error.

set_model

model
string
required

Sets the model that this LLM will use.

Should be one of ["gpt-4", "gpt-4-0613", "gpt-4-32k", "gpt-4-32k-0613", "gpt-3.5-turbo", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613"]

set_messages

messages
list[dict]
required

Sets the list of messages in OpenAI message format.

set_max_retries

max_retries
int
required

Sets the maximum number of retries for this LLM when handling errors.

set_retry_delay

retry_delay
int
required

Sets the number of seconds to wait before retrying when handling errors.

set_rate_limit_delay

rate_limit_delay
int
required

Sets the number of seconds to wait before retrying when handling rate limit error.

execute

Calls OpenAI chat completion. Handles errors and retries automatically.

Returns the response from the OpenAI API if you want to use it.