AxiomAi.Client (AxiomAI v0.1.13)

View Source

Client struct and core functionality for AxiomAI.

Summary

Functions

Generates embeddings for multiple texts in a single call.

Sends a chat message using the configured provider.

Sends a chat message with system prompt, history, and user prompt using the configured provider.

Generates a completion using the configured provider.

Generates an embedding for a single text.

Streams a chat message using the configured provider.

Streams a chat message with system prompt, history, and user prompt using the configured provider.

Streams a chat message with system prompt, history, user prompt, and files using the configured provider. Files should be a list of maps with :mime_type and :file_uri keys.

Types

t()

@type t() :: %AxiomAi.Client{config: map(), provider: atom()}

Functions

batch_embed(client, texts, opts \\ %{})

@spec batch_embed(t(), list(), map()) :: {:ok, map()} | {:error, any()}

Generates embeddings for multiple texts in a single call.

chat(client, message)

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

Sends a chat message using the configured provider.

chat(client, system_prompt, history, prompt)

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

Sends a chat message with system prompt, history, and user prompt using the configured provider.

complete(client, prompt, options)

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

Generates a completion using the configured provider.

embed(client, text, opts \\ %{})

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

Generates an embedding for a single text.

stream(client, message)

@spec stream(t(), String.t()) :: {:ok, Enumerable.t()} | {:error, any()}

Streams a chat message using the configured provider.

stream(client, system_prompt, history, prompt)

@spec stream(t(), String.t(), list(), String.t()) ::
  {:ok, Enumerable.t()} | {:error, any()}

Streams a chat message with system prompt, history, and user prompt using the configured provider.

stream(client, system_prompt, history, prompt, files)

@spec stream(t(), String.t(), list(), String.t(), list()) ::
  {:ok, Enumerable.t()} | {:error, any()}

Streams a chat message with system prompt, history, user prompt, and files using the configured provider. Files should be a list of maps with :mime_type and :file_uri keys.