factor_agent.llm.openai_compatible.OpenAICompatibleBackend#
- class OpenAICompatibleBackend(model, base_url, api_key_env=None, max_tokens=None, max_completion_tokens=None, reasoning_effort=None, timeout_seconds=600.0)[source]#
Bases:
objectComplete a request with one chat-completions call.
- Parameters:
- modelstr
The model of every call.
- base_urlstr
The provider’s endpoint, such as
https://api.deepseek.com/v1.- api_key_envstr, optional
The environment variable holding the key; None for a local server without one.
- max_tokensint, optional
The
max_tokensof every call; the provider’s default if None.- max_completion_tokensint, optional
The
max_completion_tokensof every call, in place ofmax_tokens: OpenAI’s reasoning models take only this one, and count the reasoning tokens in it.- reasoning_effortstr, optional
The
reasoning_effortof every call (such as"low","medium","high"), for a reasoning model; the provider’s default if None.- timeout_secondsfloat
Seconds a call may take.
- Raises:
- ValueError
If both
max_tokensandmax_completion_tokensare given.
Methods#
Send |
|
Build from a role's config: |
Attributes#
- OpenAICompatibleBackend.OPTIONS = ('base_url', 'api_key_env', 'max_tokens', 'max_completion_tokens', 'reasoning_effort', 'timeout_seconds')#
The options a role’s config may give besides
backendandmodel;base_urlis needed.
- OpenAICompatibleBackend.params#
The parameters every call sends with the prompt.