Arcanum.Gateway (arcanum v0.1.0)

Copy Markdown View Source

Single entry point for all inference calls.

Pipeline: auth (credential resolution) → adapter (wire protocol) → normalizer (post-processing).

Callers never touch adapters, profiles, or normalizers directly.

Summary

Functions

Synchronous chat completion. Accepts optional adapter override for testing.

Generates embeddings.

Lists available models from the provider.

Streaming chat completion.

Functions

chat(provider, intent, opts \\ [])

@spec chat(map(), Arcanum.Intent.t(), keyword()) ::
  {:ok, Arcanum.Response.t()} | {:error, term()}

Synchronous chat completion. Accepts optional adapter override for testing.

embed(provider, model, input)

@spec embed(map(), String.t(), String.t()) :: {:ok, [float()]} | {:error, term()}

Generates embeddings.

list_models(provider)

@spec list_models(map()) :: {:ok, [String.t()]} | {:error, term()}

Lists available models from the provider.

Each adapter handles its own endpoint format and filtering internally.

stream(provider, intent, opts \\ [])

@spec stream(map(), Arcanum.Intent.t(), keyword()) ::
  {:ok, Enumerable.t()} | {:error, term()}

Streaming chat completion.

Returns a normalized stream. Each delta has content fallback applied. The caller is responsible for merging deltas; the final merged response should be passed through Normalizer.normalize/2 for tool-call extraction.