AI.Util (fnord v0.9.40)
View SourceSummary
Functions
Creates an assistant message struct (AI.Message.Assistant).
This is the tool call request struct (AI.Message.FunctionCall), which must
immediately precede the matching tool_msg/3 (same id). In the Responses
API native shape, tool call requests are standalone items, not nested in an
assistant message.
A guard to identify system messages (struct or legacy raw-map form).
Returns the maximum message length allowed.
Returns a short context block describing the current project and git state. Suitable for prepending to any agent's system prompt.
Builds a "transcript" of the research process by converting the messages into text. This is most commonly used to generate a transcript of the research performed in a conversation for various agents and tool calls.
Creates a system message struct (AI.Message.System), used to define the
assistant's behavior for the conversation. The struct still matches the
%{role: ..., content: ...} raw-map shape so existing pattern matches
keep working.
Creates a tool output struct (AI.Message.FunctionCallOutput). Must
immediately follow the matching assistant_tool_msg/3 (same id).
Creates a user message struct (AI.Message.User).
Extracts the user's most recent query from the conversation messages.
Types
Functions
@spec assistant_msg(binary()) :: AI.Message.Assistant.t()
Creates an assistant message struct (AI.Message.Assistant).
@spec assistant_tool_msg(any(), binary(), binary()) :: AI.Message.FunctionCall.t()
This is the tool call request struct (AI.Message.FunctionCall), which must
immediately precede the matching tool_msg/3 (same id). In the Responses
API native shape, tool call requests are standalone items, not nested in an
assistant message.
id is coerced to a binary for the same reason as tool_msg/3.
A guard to identify system messages (struct or legacy raw-map form).
@spec max_msg_length() :: non_neg_integer()
Returns the maximum message length allowed.
@spec project_context() :: binary()
Returns a short context block describing the current project and git state. Suitable for prepending to any agent's system prompt.
Builds a "transcript" of the research process by converting the messages into text. This is most commonly used to generate a transcript of the research performed in a conversation for various agents and tool calls.
@spec system_msg(binary()) :: AI.Message.System.t()
Creates a system message struct (AI.Message.System), used to define the
assistant's behavior for the conversation. The struct still matches the
%{role: ..., content: ...} raw-map shape so existing pattern matches
keep working.
@spec tool_msg(any(), binary(), any()) :: AI.Message.FunctionCallOutput.t()
Creates a tool output struct (AI.Message.FunctionCallOutput). Must
immediately follow the matching assistant_tool_msg/3 (same id).
The func argument is kept for source compatibility and used for the
spill-to-tempfile filename heuristic; FunctionCallOutput itself does not
carry the function name (it pairs to the FunctionCall by call_id).
id is coerced to a binary - real OpenAI call_ids are strings, but test
fixtures and a few legacy code paths use integers.
@spec user_msg(binary()) :: AI.Message.User.t()
Creates a user message struct (AI.Message.User).
Extracts the user's most recent query from the conversation messages.