Skip to main content

agrag.ingestion.extract.ExtractionLLMSettings

Bases: BaseSettings

Env-backed LLM client configuration for the extraction role.

Attributes:

  • clients (list[LLMClientConfig]) – The LLM clients to use. One element for a single provider. More than one is composed per strategy.
  • strategy (Literal['single', 'fallback', 'round_robin']) – How to compose multiple clients. Ignored with one client.
  • retry (RetryConfig) – Retry configuration applied to the extraction LLM call.

Env prefix: EXTRACTION_LLM_.

Functions:

clients​

clients: list[LLMClientConfig]

from_openai_compatible_env​

from_openai_compatible_env() -> ExtractionLLMSettings

Build settings from a generic OpenAI-compatible endpoint.

Reads LLM_BASE_URL, LLM_API_KEY, and LLM_MODEL_ID from the environment or .env, so the model name is never hardcoded. Raises RuntimeError when the required variables are not all set.

Returns:

  • ExtractionLLMSettings – Settings pointing at one openai-generic client.

model_config​

model_config = SettingsConfigDict(env_prefix='EXTRACTION_LLM_', env_file='.env', extra='ignore', hide_input_in_errors=True)

retry​

retry: RetryConfig = Field(default_factory=RetryConfig)

strategy​

strategy: Literal['single', 'fallback', 'round_robin'] = 'single'