LLMDB.Provider (LLM DB v2025.12.4)

View Source

Provider struct with Zoi schema validation.

Represents an LLM provider with metadata including identity, base URL, environment variables, and documentation.

Summary

Functions

Creates a new Provider struct from a map, validating with Zoi schema.

Creates a new Provider struct from a map, raising on validation errors.

Returns the Zoi schema for Provider

Types

t()

@type t() :: %LLMDB.Provider{
  alias_of: nil | atom(),
  base_url: nil | binary(),
  config_schema:
    nil
    | [
        %{
          optional(:default) => nil | any(),
          :name => binary(),
          :type => binary(),
          optional(:doc) => nil | binary(),
          required: boolean()
        }
      ],
  doc: nil | binary(),
  env: nil | [binary()],
  exclude_models: nil | [binary()],
  extra: nil | map(),
  id: atom(),
  name: nil | binary()
}

Functions

new(attrs)

@spec new(map()) :: {:ok, t()} | {:error, term()}

Creates a new Provider struct from a map, validating with Zoi schema.

Examples

iex> LLMDB.Provider.new(%{id: :openai, name: "OpenAI"})
{:ok, %LLMDB.Provider{id: :openai, name: "OpenAI"}}

iex> LLMDB.Provider.new(%{})
{:error, _validation_errors}

new!(attrs)

@spec new!(map()) :: t()

Creates a new Provider struct from a map, raising on validation errors.

Examples

iex> LLMDB.Provider.new!(%{id: :openai, name: "OpenAI"})
%LLMDB.Provider{id: :openai, name: "OpenAI"}

schema()

Returns the Zoi schema for Provider