Jido.AI.Provider.Anthropic (Jido AI v0.5.2)

View Source

Adapter for the Anthropic AI provider.

Implements the ProviderBehavior for Anthropic's specific API.

Summary

Functions

Builds a %Jido.AI.Model{} struct from the provided options.

Lists available models from local cache or API.

Fetches a specific model by ID from the API or cache.

Normalizes a model ID to ensure it's in the correct format for Anthropic.

Functions

build(opts)

Builds a %Jido.AI.Model{} struct from the provided options.

This function validates the options, sets defaults, and creates a fully populated model struct for the Anthropic provider.

Parameters

  • opts: Keyword list of options for building the model

Returns

  • } on success
  • on failure

list_models(opts \\ [])

Lists available models from local cache or API.

Options

  • refresh: boolean - Whether to force refresh from API (default: false)
  • api_key: string - Anthropic API key (optional)

Returns a tuple with {:ok, models} on success or {:error, reason} on failure.

model(model, opts \\ [])

Fetches a specific model by ID from the API or cache.

Options

  • refresh: boolean - Whether to force refresh from API (default: false)
  • api_key: string - Anthropic API key (optional)

Returns a tuple with {:ok, model} on success or {:error, reason} on failure.

normalize(model, opts \\ [])

Normalizes a model ID to ensure it's in the correct format for Anthropic.

Options

  • No specific options for this method

Returns a tuple with {:ok, normalized_id} on success or {:error, reason} on failure.