Store or update an item in the store.
put(
self,
namespace: tuple[str, ...],
key: str,
value: dict[str, Any],
index: Literal[False] | list[str] | None = None,
*,
ttl: float | None | NotProvided = NOT_PROVIDED
) -> NoneNote:
Indexing support depends on your store implementation.
If you do not initialize the store with indexing capabilities,
the index parameter will be ignored.
Similarly, TTL support depends on the specific store implementation. Some implementations may not support expiration of items.
Store item. Indexing depends on how you configure the store:
store.put(("docs",), "report", {"memory": "Will likes ai"})
Do not index item for semantic search. Still accessible through get()
and search() operations but won't have a vector representation.
store.put(("docs",), "report", {"memory": "Will likes ai"}, index=False)
Index specific fields for search:
store.put(("docs",), "report", {"memory": "Will likes ai"}, index=["memory"])| Name | Type | Description |
|---|---|---|
namespace* | tuple[str, ...] | Hierarchical path for the item, represented as a tuple of strings.
Example: |
key* | str | Unique identifier within the namespace. Together with namespace forms the complete path to the item. |
value* | dict[str, Any] | Dictionary containing the item's data. Must contain string keys and JSON-serializable values. |
index | Literal[False] | list[str] | None | Default: NoneControls how the item's fields are indexed for search:
|
ttl | float | None | NotProvided | Default: NOT_PROVIDEDTime to live in minutes. Support for this argument depends on your store adapter. If specified, the item will expire after this many minutes from when it was last accessed. None means no expiration. Expired runs will be deleted opportunistically. By default, the expiration timer refreshes on both read operations (get/search) and write operations (put/update), whenever the item is included in the operation. |