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

View Source

Adapter for the Cloudflare AI provider.

Implements the ProviderBehavior for Cloudflare's AI 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.

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 Cloudflare 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 - Cloudflare API key (optional)
  • email: string - Cloudflare account email (optional)
  • account_id: string - Cloudflare account ID (required)

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 - Cloudflare API key (optional)
  • email: string - Cloudflare account email (optional)
  • account_id: string - Cloudflare account ID (required)

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