Behaviour for inference provider adapters.
Each adapter (Ollama, OpenAI, Anthropic, etc.) implements this behaviour to provide a uniform interface for chat completion, model listing, and media generation.
All provider/model-specific serialization decisions are driven by ModelProfile.
Usage
use Arcanum.ProviderOptional callbacks (embed/3, generate_image/3, generate_video/3) return
{:error, :not_supported} by default. Override only what the adapter supports.
Summary
Callbacks
Sends a chat completion request and returns the full response.
Generates embeddings for the given text input.
Generates images from a text prompt.
Generates videos from a text prompt.
Lists available models from the provider.
Sends a streaming chat completion request.
Returns a stream of {:data, response} events, terminated by :done.
Types
@type stream_event() :: {:data, Arcanum.Response.t()} | {:error, term()} | :done
Callbacks
@callback chat( provider :: map(), intent :: Arcanum.Intent.t(), profile :: Arcanum.ModelProfile.t() ) :: {:ok, Arcanum.Response.t()} | {:error, term()}
Sends a chat completion request and returns the full response.
@callback embed(provider :: map(), model :: String.t(), input :: String.t()) :: {:ok, [float()]} | {:error, term()}
Generates embeddings for the given text input.
@callback generate_image( provider :: map(), intent :: Arcanum.MediaIntent.t(), profile :: Arcanum.ModelProfile.t() ) :: {:ok, Arcanum.MediaResponse.t()} | {:error, term()}
Generates images from a text prompt.
@callback generate_video( provider :: map(), intent :: Arcanum.MediaIntent.t(), profile :: Arcanum.ModelProfile.t() ) :: {:ok, Arcanum.MediaResponse.t()} | {:error, term()}
Generates videos from a text prompt.
Lists available models from the provider.
@callback stream( provider :: map(), intent :: Arcanum.Intent.t(), profile :: Arcanum.ModelProfile.t() ) :: {:ok, Enumerable.t()} | {:error, term()}
Sends a streaming chat completion request.
Returns a stream of {:data, response} events, terminated by :done.