SDK: Memory
Overview
Section titled “Overview”The Memory API manages user/agent/app memories and vector store search. It provides sync and async clients with consistent method shapes.
Exports:
FlotorchMemory
,FlotorchAsyncMemory
– CRUD + search for memoriesFlotorchVectorStore
,FlotorchAsyncVectorStore
– semantic search in a vector store
from flotorch.sdk.memory import ( FlotorchMemory, FlotorchAsyncMemory, FlotorchVectorStore, FlotorchAsyncVectorStore,)
API_KEY = "<your_api_key>"BASE_URL = "https://gateway.flotorch.cloud"PROVIDER = "<flotorch_memory_provider>" # FloTorch Memory Provider configured in the FloTorch ConsoleVECTORSTORE_ID = "<your_vectorstore_id>"
Memory clients
Section titled “Memory clients”FlotorchMemory
Section titled “FlotorchMemory”FlotorchMemory( api_key: str, base_url: str, provider_name: str,)
add(…) -> dict
Section titled “add(…) -> dict”add( messages: list[dict], userId: str | None = None, agentId: str | None = None, appId: str | None = None, sessionId: str | None = None, metadata: dict | None = None, timestamp: str | None = None, providerParams: dict | None = None,) -> dict
- Adds one or more chat-style messages to memory.
get(…) -> dict
Section titled “get(…) -> dict”get(memory_id: str) -> dict
- Fetches a memory by id.
update(…) -> dict
Section titled “update(…) -> dict”update( memory_id: str, content: str | None = None, metadata: dict | None = None,) -> dict
- Updates memory content and/or metadata.
delete(…) -> dict
Section titled “delete(…) -> dict”delete(memory_id: str) -> dict
- Deletes a memory by id.
search(…) -> dict
Section titled “search(…) -> dict”search( userId: str | None = None, agentId: str | None = None, appId: str | None = None, sessionId: str | None = None, createFrom: str | None = None, createTo: str | None = None, updateFrom: str | None = None, updateTo: str | None = None, categories: list[str] | None = None, metadata: dict | None = None, page: int | None = 1, limit: int | None = 20, query: str | None = None,) -> dict
- Searches memories using rich filters. Returns provider-shaped payload.
FlotorchAsyncMemory
Section titled “FlotorchAsyncMemory”Constructor:
FlotorchAsyncMemory( api_key: str, base_url: str, provider_name: str,)
Async equivalents of add
, get
, update
, delete
, and search
are provided with the same parameters and return shapes.
Vector store clients
Section titled “Vector store clients”FlotorchVectorStore
Section titled “FlotorchVectorStore”Constructor:
FlotorchVectorStore( base_url: str, api_key: str, vectorstore_id: str,)
search(…) -> dict
Section titled “search(…) -> dict”search( query: str, max_number_of_result: int | None = None, ranker: str | None = None, score_threshold: float | None = None, rewrite_query: bool | None = None,) -> dict
- Runs semantic search. Optional parameters act as overrides.
FlotorchAsyncVectorStore
Section titled “FlotorchAsyncVectorStore”Constructor:
FlotorchAsyncVectorStore( base_url: str, api_key: str, vectorstore_id: str,)
Async search
with the same parameters as the sync client.
- Provide valid
provider_name
configured in your FloTorch deployment.