Arcanum.Intent (arcanum v0.1.1)

Copy Markdown View Source

Canonical request struct for inference calls.

Normalizes the request format across all providers so that the adapter layer handles provider-specific serialization.

Content is always a list of typed blocks — no raw strings.

Content Blocks

%{role: :user, content: [
  %{type: :text, text: "What's in this image?"},
  %{type: :image_url, url: "https://..."},
  %{type: :image_base64, media_type: "image/png", data: "iVBOR..."}
]}

Summary

Functions

Wraps a plain string as a single text content block.

Extracts all text from content blocks, joined by newline.

Types

content_block()

@type content_block() ::
  %{type: :text, text: String.t()}
  | %{type: :image_url, url: String.t()}
  | %{type: :image_base64, media_type: String.t(), data: String.t()}

message()

@type message() :: %{role: atom(), content: [content_block()]}

t()

@type t() :: %Arcanum.Intent{
  context_length: pos_integer() | nil,
  max_tokens: pos_integer() | nil,
  messages: [message()],
  model: String.t(),
  temperature: float() | nil,
  tools: [tool()] | nil
}

tool()

@type tool() :: %{
  type: String.t(),
  function: %{name: String.t(), description: String.t(), parameters: map()}
}

Functions

text(str)

@spec text(String.t()) :: [content_block()]

Wraps a plain string as a single text content block.

to_text(blocks)

@spec to_text([content_block()]) :: String.t()

Extracts all text from content blocks, joined by newline.