Skip to main content

Module tools

Module tools 

Source
Expand description

Built-in tools: exact functions the engine runs itself when a model calls them in the Hermes function-calling contract of the Embryo cores (<tool_call>{"name": …, "arguments": …}</tool_call> in an assistant turn, the result back as <tool_response>…</tool_response> in a tool turn). A small model fills the call’s fields the way it fills a card’s placeholders; the counting and the arithmetic, which it does badly, are done here, exactly.

  • calc: an expression over exact rationals (i128 numerator and denominator, overflow is an error, never a rounded result): + - * / % ^, parentheses, sum min max mean abs round floor ceil.
  • table: the last command output read as a Table: count sum min max mean get argmax argmin diff over a column, with a row-name filter (rows) and a cell test (where).

round runs the calls of one assistant turn when every one of them is built in and renders the tool turns that follow it; the server loops on it (/v1/completions with builtin_tools). The descriptions the model is shown are tools.json (descriptions); the trace generators read the same file.

Structs§

Q
An exact rational: n / d, d > 0, reduced.
Round
One built-in round: the calls run and the tool turns that answer them.
Table
A command output as a table: one row a line, cells split by whitespace, an optional header row; total lines (1425 total, total 48) are not rows.

Constants§

TOOLS_JSON
The model-facing descriptions ({"name", "description", "parameters"}).

Functions§

calc
Evaluates an arithmetic expression exactly.
call
Runs a built-in tool. input is the text table reads (see last_output); calc ignores it.
cell_number
A cell’s number: 8345, 27G, 1.5Gi, 46%, 3KB (the unit or % dropped).
continue_prompt
The prompt that continues after a built-in round: the assistant turn closed, the tool turns, a new assistant turn opened.
descriptions
is_builtin
last_output
The text table reads at the end of prompt (a cmf-im-v1 transcript): the last tool response after the last user turn, else that user turn; a prompt without turns is read whole.
outputs
The texts table may read at the end of prompt, newest first: the tool responses after the last user turn, then that user turn (a prompt without turns is one text). A second table call after a result reads the table again, not the previous result.
parse_number
A decimal literal (12, -3.25, .5) as an exact rational.
round
Runs the calls of the assistant turn generated (continuing prompt) when it has calls and every one is built in; None otherwise (no call, a malformed block, or a call the client serves). A failing call answers error: …, which the model reads like any tool result.
table
The table tool over input (see Table::parse).
turn_calls
The <tool_call> blocks of an assistant turn: (name, arguments), None for a block that is not a call object.