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 via json.

  • metadata: String (JSON) — the caller metadata dict.

  • _schema_version: Int8 — always 1 for 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 via json.

  • metadata: String (JSON) — the caller metadata dict.

  • _schema_version: Int8 — always 1 for 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 TurnVectorStore to 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 TurnVectorStore whose entries and ordering match what was persisted.

Raises:
Return type:

TurnVectorStore

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 TurnVectorStore whose entries and ordering match what was persisted.

Raises:
Return type:

TurnVectorStore

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 TurnVectorStore to serialize.

  • path (str) – Destination file path. Parent directories are created.

Return type:

None