std1.0.0-beta-7 SafeC docs

Module ml::llm

#include <std/ml/llm.h> source

LLM orchestration (LangChain/LangGraph/ LangSmith-inspired).

A thin layer over std::http/std::Value: LlmClient speaks the OpenAI-chat-completions wire shape (the de facto standard most local and hosted LLM servers — vLLM's own OpenAI-compatible server included — implement), PromptTemplate does '{var}' substitution, Chain runs a fixed step sequence, the Graph executor runs named nodes connected by fixed or conditional edges over a shared Value state (LangGraph's core idea), and Tracer keeps an in-memory, JSON-dumpable log of named input/output/timing events (LangSmith's core idea) — none of these call out to any hosted service themselves; verification in this session used a local mock HTTP server standing in for an LLM endpoint, the same technique std/rpc/server_fn.h's own tests used.

Structs

LlmMessage
LlmClient
Chain
GraphNode
Graph
TraceEvent
Tracer

Type aliases

ChainStepFnA fixed sequence of Value -> Value steps, run in order — the output of each step becomes the input to the next.
GraphNodeFnNamed nodes transform a shared Value state; each node either always advances to a fixed 'nextNode', or (if 'router' is set) calls 'router' on the post-node state to pick the next node by name. Graph::run() starts at the graph's entry node and keeps following edges until a node returns/routes to "end", a named node isn't found (also treated as end), or 'maxSteps' is hit (guards against an accidental infinite loop in a misconfigured graph).
GraphRouterFn

Functions

prompt_template_renderReplaces every '{name}' occurrence in 'tmpl' with 'vars' object field 'name' (stringified: strings pass through as-is, numbers/bools render via their natural text form). A '{name}' whose key isn't present in 'vars' is left as literal text, unexpanded.