CrucibleIR.Backend.Prompt (CrucibleIR v0.3.0)

View Source

Universal prompt IR for backend requests.

Supports chat-style messages, tool calling, and multimodal content in a provider-agnostic shape.

Fields

  • :messages - Message history
  • :system - System prompt (optional)
  • :tools - Tool definitions (optional)
  • :tool_choice - Tool selection directive
  • :options - Backend options
  • :request_id - Request correlation ID
  • :trace_id - Trace correlation ID
  • :metadata - Additional metadata

Examples

iex> %CrucibleIR.Backend.Prompt{messages: [%{role: :user, content: "Hello"}]}

Summary

Types

content_part()

@type content_part() ::
  %{type: :text, text: String.t()}
  | %{type: :image, url: String.t(), media_type: String.t() | nil}
  | %{type: :image, base64: String.t(), media_type: String.t()}
  | %{type: :audio, url: String.t(), format: String.t()}
  | %{type: :tool_result, tool_call_id: String.t(), content: String.t()}

message()

@type message() :: %{
  role: role(),
  content: String.t() | [content_part()],
  name: String.t() | nil,
  tool_calls: [tool_call()] | nil,
  tool_call_id: String.t() | nil
}

role()

@type role() :: :system | :user | :assistant | :tool

t()

@type t() :: %CrucibleIR.Backend.Prompt{
  messages: [message()],
  metadata: map(),
  options: CrucibleIR.Backend.Options.t(),
  request_id: String.t() | nil,
  system: String.t() | nil,
  tool_choice: tool_choice() | nil,
  tools: [tool()] | nil,
  trace_id: String.t() | nil
}

tool()

@type tool() :: map()

tool_call()

@type tool_call() :: %{
  id: String.t(),
  name: String.t(),
  arguments: map() | String.t()
}

tool_choice()

@type tool_choice() :: :auto | :none | :required | %{name: String.t()}