build_llm_provider (llm/factory.py)

EverOS · src/everos/component/llm/factory.py · python · Apache-2.0
ai

Creates an OpenAI-compatible LLM provider from configuration settings.

# Source: https://github.com/EverMind-AI/EverOS | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Factory for building an LLM provider from :class:`LLMSettings`."""

from __future__ import annotations

from everos.component.utils.config_hints import missing_config_error
from everos.config import LLMSettings

from .openai_provider import OpenAIProvider
from .protocol import LLMClient


def build_llm_provider(settings: LLMSettings) -> LLMClient:
    """Build an OpenAI-compatible LLM provider from settings.

    Unwraps :class:`pydantic.SecretStr` here so downstream callers never
    touch the raw key directly. Fails fast if either ``api_key`` or
    ``base_url`` is missing — caller 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key