teff.tool.builtin.rag_ingest¶
teff.tool.builtin.rag_ingest
¶
Write tool — add documents to a vector store from a workflow YAML.
rag searches an existing store; rag_ingest is the write side: it
takes document text or a file (csv / txt / pdf / excel), chunks it, embeds
it and persists the vectors in the same :class:~teff.rag.base.VectorStore
config format. Together they turn a vector store into a living knowledge
base that a workflow can grow at runtime — e.g. a Telegram user drops a CSV
and the agent embeds it before answering.
AI-parsing happens before the tool in the workflow: run an llm_chat
(or transform) node that normalizes the raw payload into clean text and
write it to a state key, then rag_ingest with text: "{that_key}".
The tool itself only loads, chunks, embeds and stores — no hidden model
calls, so it is deterministic and cheap to test.
Classes:
| Name | Description |
|---|---|
RAGIngestTool |
Add documents to a vector store. |
RAGIngestTool
¶
Bases: Tool
Add documents to a vector store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
Raw document text to chunk, embed and store (inline content). |
required | |
path
|
File to load instead of text (see config |
required | |
source_id
|
Optional stable id for the document (default: derived). |
required | |
metadata
|
Extra metadata dict merged into every chunk. |
required |
Args (config):
embedder: Embedder config (same shape as the rag tool).
store: Vector-store config (same shape as the rag tool).
chunker: Optional chunker kwargs.
type: Loader for path — csv (default), txt, pdf,
excel. Ignored when text is provided.
text_column: Column used as text when loading a CSV/Excel file.
parent_chunks: Keep full parent text per chunk (default false).
At least one of text or path must be supplied per call. The
result is a short confirmation with the number of chunks written.
Source code in teff/tool/builtin/rag_ingest.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |