AI library
Model operations. Bound by AI Flow on top of the common library.
Every model call goes through the AI Gateway, so an atom here names an alias rather than a provider. Which model that resolves to, what it costs and whether it is cached are configuration, not flow text, which is what lets a flow outlive the model it was written against.
Generation
Section titled “Generation”| Operation | Flow task | Script functions | |
|---|---|---|---|
| Chat completion | chat: | llm.chat, llm.complete | pipeline-only |
| Intent detection | getintent: | intent.classify | pipeline-only |
| Guardrails | pre-guard:, post-guard: | guard.check | pipeline-only |
pre-guard: and post-guard: are the same atom in two positions, before the model sees
input, and after it produces output. Both are worth having: an input guard stops what should never
reach a model, an output guard stops what should never reach a user.
Embeddings and vectors
Section titled “Embeddings and vectors”| Operation | Flow task | Script functions | |
|---|---|---|---|
| Embeddings | embed:, embeddata: | embed.generate | pipeline-only |
| Chunk text | — | embed.split | callable anywhere |
| Vector upsert | vector-upsert: | vector.upsert | callable anywhere |
| Vector search | vector-search: | vector.search | callable anywhere |
| Vector delete | vector-delete: | vector.delete | callable anywhere |
| Vector list | vector-list: | vector.list | callable anywhere |
| Collections | topicsinsert:, topicsquery:, topicssearch:, topicslist:, topicsdelete: | milvus.insert, .query, .search, .list, .delete | pipeline-only |
embed.split chunks text before embedding it. Chunking is where retrieval quality is usually won
or lost, so it is a separate call rather than a hidden step inside generate.
Retrieval
Section titled “Retrieval”| Operation | Flow task | Script functions | |
|---|---|---|---|
| Ingest a corpus | rag-ingest: | rag.ingest | callable anywhere |
| Answer from a corpus | rag-answer: | rag.answer | callable anywhere |
| Rerank results | rerank: | rag.rerank | callable anywhere |
Reranking is the cheapest quality improvement available to a retrieval pipeline: retrieve broadly, then rerank to precision. It is a separate atom because the two steps want different models.
Reasoning
Section titled “Reasoning”| Operation | Flow task | Script functions | |
|---|---|---|---|
| Tree of thought | tot: | reason.tot | callable anywhere |
| Reflexion | reflexion: | reason.reflexion | callable anywhere |
Both are multi-step patterns with a cost profile to match. They call a model repeatedly by design. Use them where a single call demonstrably is not enough, and put a budget on them. In a flow that means a harness rather than a plain flow.
Content
Section titled “Content”| Operation | Flow task | Script functions | |
|---|---|---|---|
| Scrape a source | scrape:, scrapedata: | scrape.web, .pdf, .excel, .docx, .pptx | pipeline-only |
| Split into sentences | tosentence: | text.tosentence | pipeline-only |
| Split on a delimiter | — | text.split | callable anywhere |
| Validate JSON | validate-json: | validate.json | callable anywhere |
| Validate YAML | validate-yaml: | validate.yaml | callable anywhere |
validate-json: earns its place next to a model call, a model asked for JSON usually produces
JSON; validating rather than assuming is the difference between a flow that fails at the
validation node and one that fails three nodes later with something unhelpful. Both validators
require a schema, validating against nothing is just a parse.
Pipelines
Section titled “Pipelines”| Operation | Flow task | Script functions | |
|---|---|---|---|
| Pipeline chat | mlpipelinechat:, mlpipechat: | pipeline.chat | pipeline-only |
| Pipeline request | mlpipelinerequest:, mlpiperequest: | pipeline.request | pipeline-only |
| Pipeline response | mlpipelineresponse:, mlpiperesponse: | pipeline.response | pipeline-only |
These are the innermost surface: they act on the pipe and the record currently in flight, so they only mean anything inside a running pipeline.
Streaming sources
Section titled “Streaming sources”AI Flow also binds the streaming forms of the pipeline operations, so a flow can read a source and
feed it to a model without changing engine: readcsv:, readdb:, readexcel:, readparquet:,
readrest:, readstdout:, streamrest:, streamplugin:, streamprint:, aggsum:, sum:,
sumstr:, replicate:, writecsv:, writedb:, writeexcel:, writeparquet:, noop:.
For bulk movement with no model involved, use Datapipes instead. It is built for the record stream and does not carry the rest of this library.
See also
Section titled “See also”- AI Flow: the engine that binds this library
- AI Gateway: aliases, budgets, caching, fallback
- Atom reference: full parameters