ax() API
Structured generation APIs for typed programs.
Most Used
axllm::ax
Create an AxGen program from a string or parsed signature.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | ax |
| API section | AxGen |
| Form | axllm::ax(signature, options) |
| Returns | AxGen |
Important Options
functionsexamplesdemossample countresult pickermodelConfigmaxRetriesstreaming assertionsfield processorscontrolasyncMode
Examples
auto qa = axllm::ax("question:string -> answer:string");axllm::AxGen
Structured generation program with indexed multi-sampling, winner selection, forward, streaming, optimization, trace, usage, and tool-call behavior.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxGen |
| API section | AxGen |
| Form | axllm::AxGen(signature, options) |
| Returns | program object |
Important Options
signaturefunctionsexamplesdemossample countresult pickermemoryprompt template
axllm::Tool
Build a typed function tool. Rust uses tool because fn is reserved.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | fn |
| API section | Tools |
| Form | axllm::Tool(name, description, parameters, handler) |
| Returns | tool builder or Tool |
Important Options
namedescriptionargsreturnshandlerexecution: blocking or backgroundcancellation-aware handler
Examples
axllm::Tool search("search", "Search docs", axllm::object({}), handler);Advanced / internals / full reference
axllm::run_control
Create a controller for scoped steering, reasoning updates, cancellation, and queued/applied lifecycle events. Pass it through forward options.
| Field | Value |
|---|---|
| Kind | function |
| Ax concept | run_control |
| API section | AxGen |
| Form | axllm::run_control() |
| Returns | AxRunControl |
Examples
auto control = axllm::run_control();axllm::AxRunControl
Run control shared by active and future descendant programs. Cancellation reports unresolved work and does not undo external effects.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | AxRunControl |
| API section | AxGen |
| Form | axllm::AxRunControl |
| Returns | run controller |
Important Options
steerthinking token budgettarget pathabortevent listener
axllm::Tool
Callable tool descriptor with JSON-schema-compatible parameters and a host handler.
| Field | Value |
|---|---|
| Kind | type |
| Ax concept | Tool |
| API section | Tools |
| Form | axllm::Tool |
| Returns | tool descriptor |
Important Options
parametersreturnshandler
Full Reference
Open the full C++ reference. This page highlights the ax symbols most relevant to everyday use.