AI.Message.System (fnord v0.9.40)

View Source

System/developer instruction message.

Internal shape (matches the chat-completions raw map shape that existing pattern matches expect):

%AI.Message.System{role: "developer" | "system", content: "<binary>"}

The role field is configurable: OpenAI's Responses-era convention is "developer"; Venice and other providers may prefer the legacy "system". Construct via AI.Message.system/2 and pass role: in opts when needed.

Wire shape (built on demand by to_map/1):

%{type: "message", role: <role>,
  content: [%{type: "input_text", text: "..."}]}

Summary

Functions

Hydrate from a Responses-shaped or legacy chat-completions-shaped map (atom or string keys). Preserves the role from the source so "system" and "developer" round-trip distinctly.

Build a system message from a binary.

Types

t()

@type t() :: %AI.Message.System{content: binary(), role: binary()}

Functions

from_map(raw)

@spec from_map(map()) :: t()

Hydrate from a Responses-shaped or legacy chat-completions-shaped map (atom or string keys). Preserves the role from the source so "system" and "developer" round-trip distinctly.

new(text, opts \\ [])

@spec new(
  binary(),
  keyword()
) :: t()

Build a system message from a binary.

Options:

  • :role - override the default "developer" role with "system" (or any other string a provider expects).