AxiomAi.Provider behaviour (AxiomAI v0.1.2)

View Source

Provider behavior and dispatcher for different AI providers.

Summary

Functions

Dispatches chat requests to the appropriate provider.

Dispatches chat requests with system prompt, history, and user prompt to the appropriate provider.

Dispatches completion requests to the appropriate provider.

Callbacks

chat(config, message)

@callback chat(config :: map(), message :: String.t()) :: {:ok, map()} | {:error, any()}

chat(config, system_prompt, history, prompt)

@callback chat(
  config :: map(),
  system_prompt :: String.t(),
  history :: list(),
  prompt :: String.t()
) ::
  {:ok, map()} | {:error, any()}

complete(config, prompt, options)

@callback complete(config :: map(), prompt :: String.t(), options :: map()) ::
  {:ok, map()} | {:error, any()}

Functions

chat(provider, config, message)

@spec chat(atom(), map(), String.t()) :: {:ok, map()} | {:error, any()}

Dispatches chat requests to the appropriate provider.

chat(provider, config, system_prompt, history, prompt)

@spec chat(atom(), map(), String.t(), list(), String.t()) ::
  {:ok, map()} | {:error, any()}

Dispatches chat requests with system prompt, history, and user prompt to the appropriate provider.

complete(provider, config, prompt, options)

@spec complete(atom(), map(), String.t(), map()) :: {:ok, map()} | {:error, any()}

Dispatches completion requests to the appropriate provider.