core.memory.persist
Parquet persistence for TurnVectorStore.
Serializes the in-memory store to a single Parquet file so vector-indexed
memory survives process restarts when the user opts in via
config.memory.persist: true.
Schema (v1):
text:String— the plain text that was embedded.embedding:List(Float64)— the float vector.turn:String(JSON) — the raw turn dict, round-tripped viajson.metadata:String(JSON) — the caller metadata dict._schema_version:Int8— always1for this version.
Functions are stateless I/O helpers; the store itself remains in-memory.
Parquet persistence for TurnVectorStore.
Serializes the in-memory store to a single Parquet file so vector-indexed
memory survives process restarts when the user opts in via
config.memory.persist: true.
Schema (v1):
text:String— the plain text that was embedded.embedding:List(Float64)— the float vector.turn:String(JSON) — the raw turn dict, round-tripped viajson.metadata:String(JSON) — the caller metadata dict._schema_version:Int8— always1for this version.
Functions are stateless I/O helpers; the store itself remains in-memory.
- persist_store(store, path)[source]
Write all entries in store to a Parquet file at path.
Overwrites any existing file. Empty stores produce a valid zero-row Parquet file.
- Parameters:
store (TurnVectorStore) – The
TurnVectorStoreto serialize.path (str) – Destination file path. Parent directories are created.
- Return type:
None
- load_store(path)[source]
Load a Parquet file written by
persist_store()into a fresh store.- Parameters:
path (str) – Source file path.
- Returns:
A new
TurnVectorStorewhose entries and ordering match what was persisted.- Raises:
FileNotFoundError – If path does not exist.
ValueError – If the file’s
_schema_versionis not1.
- Return type:
Functions
- load_store(path)[source]
Load a Parquet file written by
persist_store()into a fresh store.- Parameters:
path (str) – Source file path.
- Returns:
A new
TurnVectorStorewhose entries and ordering match what was persisted.- Raises:
FileNotFoundError – If path does not exist.
ValueError – If the file’s
_schema_versionis not1.
- Return type:
- persist_store(store, path)[source]
Write all entries in store to a Parquet file at path.
Overwrites any existing file. Empty stores produce a valid zero-row Parquet file.
- Parameters:
store (TurnVectorStore) – The
TurnVectorStoreto serialize.path (str) – Destination file path. Parent directories are created.
- Return type:
None