Sycophant.ModelResolver (sycophant v0.4.2)

Copy Markdown

Resolves model identifiers into pipeline-ready metadata.

Takes a model specification (e.g., "openai:gpt-4o-mini") and returns a normalized map containing everything the pipeline needs: model ID, provider atom, base URL, wire protocol adapter module, and the raw LLMDB structs.

Model Specification Format

Models are identified as "provider:model_id" strings:

  • "openai:gpt-4o-mini" - OpenAI GPT-4o Mini
  • "anthropic:claude-haiku-4-5-20251001" - Anthropic Claude Haiku
  • "amazon_bedrock:anthropic.claude-3-5-sonnet-20241022-v2:0" - Bedrock Claude
  • "google:gemini-2.0-flash" - Google Gemini
  • "azure:gpt-4o" - Azure OpenAI

Model metadata is sourced from LLMDB as the single source of truth.

Summary

Functions

Resolves a model specification into a normalized map for the pipeline.

Functions

resolve(model)

@spec resolve(nil | binary() | LLMDB.Model.t() | term()) ::
  {:ok, map()} | {:error, Exception.t()}

Resolves a model specification into a normalized map for the pipeline.

Accepts a "provider:model" string, an %LLMDB.Model{} struct, or nil. Looks up the model and its provider in LLMDB, selects the appropriate wire protocol adapter, and returns a map with :model_id, :provider, :base_url, :wire_adapter, :env_vars, and the raw LLMDB structs. When a string spec contains a model ID that differs from the canonical one, the requested ID takes precedence.

resolve_embedding(model)

@spec resolve_embedding(nil | binary() | LLMDB.Model.t() | term()) ::
  {:ok, map()} | {:error, Exception.t()}