mixle.substrate.ingest module¶
Ingest adapters: pull the stores the ecosystem already has into the knowledge substrate.
The substrate does not want copies of everything – it wants TYPED, PROVENANCED, RETRIEVABLE entries
pointing at what already exists. These adapters turn the three stores mixle already keeps into
SubstrateItem s:
ingest_documents– raw text / passages ->kind="text"items (the RAG corpus).
ingest_artifacts– a registry directory of deployed model/dataset artifacts (each amanifest.json) ->kind="artifact"items whose text surface is the manifest summary and whose payload references the artifact path (so lineage + retrieval work without copying weights).
ingest_traces– a harvested.jsonl(the/feedback/ agent-trace format) ->kind="trace"items (input->answer pairs for retrieval and curriculum).
Every item carries provenance (source path, kind, ingest time) so the reasoner can cite where a piece of knowledge came from.
- ingest_documents(substrate, docs, *, source='documents', scope='local')[source]
Add text passages to the substrate as
kind="text"items. Returns the new item ids.Each doc is a string, or a
{"text": ..., "tags": [...], "payload": {...}}dict for metadata.
- ingest_artifacts(substrate, registry_root, *, scope='local')[source]
Index every deployed artifact under
registry_root(dirs containing amanifest.json).The item’s text surface is a human summary of the manifest (kind, io, meta); its payload REFERENCES the artifact directory (
{"ref": path}) rather than copying it, and provenance carries the manifest’s lineage fields when present.
- ingest_traces(substrate, jsonl_path, *, source=None, scope='local')[source]
Index a harvested
.jsonlof{"input": ..., "answer"/"label"/"call": ...}rows as traces.
- ingest_records(substrate, records, *, source='records', scope='local', text_fields=None)[source]
Add a sequence of records (dicts or tuples) to the substrate as
kind="record"items.Each record’s payload is stored structured; its retrievable text surface is the
text_fields(for dict records) joined, else the whole serialized record – so records are searchable by content.
- ingest_file(substrate, path, *, kind=None, source=None, scope='local')[source]
Ingest a data file into the substrate. Format inferred from the extension unless
kindforces it..txt/.md-> onetextitem per non-empty line;.jsonl-> one item per JSON line (a string /{"text": ...}becomes a text item, any other object a record item);.csv-> onerecorditem per row keyed by the header.sourcedefaults to the file path.