Skip to content
GitHub

Configuration

The config section key is ai_llm. Environment prefix: LEX_AI_LLM__.

KeyTypeDefaultEnv VarDescription
enabledboolTrueLEX_AI_LLM__ENABLEDEnable the LLM subsystem
providerModelProvider (str enum)"openai"LEX_AI_LLM__PROVIDERLLM provider name
modelstr"gpt-4-turbo"LEX_AI_LLM__MODELModel name or identifier
api_keySecretStr | NoneNoneLEX_AI_LLM__API_KEYAPI key for the provider
api_basestr | NoneNoneLEX_AI_LLM__API_BASECustom API base URL
temperaturefloat0.7LEX_AI_LLM__TEMPERATURESampling temperature (0.0–2.0)
max_tokensint | NoneNoneLEX_AI_LLM__MAX_TOKENSMax tokens in response
timeoutfloat60.0LEX_AI_LLM__TIMEOUTRequest timeout in seconds
enable_cacheboolFalseLEX_AI_LLM__ENABLE_CACHEEnable response caching
cache_ttlint3600LEX_AI_LLM__CACHE_TTLCache TTL in seconds
thinkingThinkingConfig | NoneNoneLEX_AI_LLM__THINKING__*Thinking/reasoning config
extradict[str, Any]{}LEX_AI_LLM__EXTRA__*Provider-specific extra params

When thinking is set, the ThinkingConfig object supports:

KeyTypeDefaultDescription
suppressboolFalseActively suppress thinking tokens
budget_tokensint10000Max tokens for reasoning
levelstr | NoneNoneGemini 3 thinking level (minimal, low, medium, high)
effortstr | NoneNoneOpenAI reasoning effort (low, medium, high)
application.yaml
ai_llm:
provider: openai
model: gpt-4o
temperature: 0.3
max_tokens: 2000
timeout: 30
enable_cache: true
cache_ttl: 7200
thinking:
budget_tokens: 5000
Terminal window
export LEX_AI_LLM__PROVIDER=anthropic
export LEX_AI_LLM__MODEL=claude-sonnet-4-20250514
export LEX_AI_LLM__API_KEY=sk-ant-...
export LEX_AI_LLM__TEMPERATURE=0.0
export LEX_AI_LLM__ENABLE_CACHE=true

Install the provider-specific client library:

Terminal window
uv add "lexigram-ai-llm[openai]" # openai, tiktoken
uv add "lexigram-ai-llm[anthropic]" # anthropic
uv add "lexigram-ai-llm[ollama]" # ollama
uv add "lexigram-ai-llm[groq]" # groq
uv add "lexigram-ai-llm[cohere]" # cohere
uv add "lexigram-ai-llm[mistral]" # mistralai