View Source AI.Util (fnord v0.6.0)

Summary

Functions

Creates an assistant message object, representing the assistant's response.

This is the tool call message, which must come immediately before the tool_msg/3 message with the same tool_call_id (id).

Counts the number of steps in the research process. A step is identified using planner messages as a proxy for each iteration in the research process. This function only counts the steps in the most recent iteration of the overall conversation by starting its count from the most recent user message.

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 object, used to define the assistant's behavior for the conversation.

This is the tool outputs message, which must come immediately after the assistant_tool_msg/3 message with the same tool_call_id (id).

Creates a user message object, representing the user's input prompt.

Extracts the user's most recent query from the conversation messages.

Functions

agent_to_agent_prompt()

assistant_msg(msg)

Creates an assistant message object, representing the assistant's response.

assistant_tool_msg(id, func, args)

This is the tool call message, which must come immediately before the tool_msg/3 message with the same tool_call_id (id).

cosine_similarity(vec1, vec2)

count_steps(msgs)

Counts the number of steps in the research process. A step is identified using planner messages as a proxy for each iteration in the research process. This function only counts the steps in the most recent iteration of the overall conversation by starting its count from the most recent user message.

note_format_prompt()

parse_topic_list(input_str)

@spec parse_topic_list(String.t()) :: [String.t()]

research_transcript(msgs)

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.

system_msg(msg)

Creates a system message object, used to define the assistant's behavior for the conversation.

tool_msg(id, func, output)

This is the tool outputs message, which must come immediately after the assistant_tool_msg/3 message with the same tool_call_id (id).

user_msg(msg)

Creates a user message object, representing the user's input prompt.

user_query(messages)

Extracts the user's most recent query from the conversation messages.

validate_notes_string(notes_string)

@spec validate_notes_string(String.t()) ::
  {:ok, [String.t()]} | {:error, :invalid_format}