ADK.Model.Registry (adk_ex v1.1.0)

Copy Markdown View Source

Resolves model name strings to provider structs.

Pattern matches model name prefixes to determine the provider:

  • "gemini-*"ADK.Model.Gemini
  • "claude-*"ADK.Model.Claude (direct Anthropic API)
  • "gpt-*", "o1*", "o3*"ADK.Model.LiteLlm configured for OpenAI (base_url: "https://api.openai.com/v1")
  • Any name containing "/" (e.g. "openai/gpt-4o", "anthropic/claude-3-5-sonnet-20241022", "ollama/llama3") → ADK.Model.LiteLlm. These are the model strings understood by the LiteLLM proxy and require :base_url to be passed via opts so we know where the proxy is running.

To use any other OpenAI-compatible endpoint (Groq, Together, OpenRouter, vLLM, LM Studio, etc.) construct the ADK.Model.LiteLlm struct directly rather than going through the registry.

Summary

Functions

Resolves a model name to a configured provider struct.

Functions

resolve(name, opts \\ [])

@spec resolve(
  String.t(),
  keyword()
) :: {:ok, struct()} | {:error, atom()}

Resolves a model name to a configured provider struct.

Options:

  • :api_key — API key for the provider (required)
  • :base_url — override the default base URL (optional for Gemini/Claude/OpenAI; required for slash-namespaced names like "openai/gpt-4o" that target a LiteLLM proxy)