UniMemory SDK - The memory layer for your AI apps.
Project description
UniMemory
The memory layer for your AI apps.
Installation
pip install unimemory
Quick Start
from unimemory import UniMemory
client = UniMemory(api_key="um_live_xxx...")
# Or set UNIMEMORY_API_KEY environment variable
# Add a memory
result = client.add_memory(content="User prefers dark mode")
print(f"Remembered: {result.was_worth_remembering}")
# Search memories
results = client.search("user preferences")
for r in results.results:
print(f"{r.content} (score: {r.score})")
API
Initialize
from unimemory import UniMemory
# With API key
client = UniMemory(api_key="um_live_xxx...")
# Or using environment variable
import os
os.environ["UNIMEMORY_API_KEY"] = "um_live_xxx..."
client = UniMemory()
# Custom base URL
client = UniMemory(
api_key="um_live_xxx...",
base_url="http://localhost:8000/api/v1"
)
Add Memory
result = client.add_memory(
content="User clicked the buy button",
source_app="my-app", # optional
user_id="user123", # optional
metadata={"page": "checkout"} # optional
)
print(result.was_worth_remembering) # True/False
print(result.extracted_count) # Number of memories extracted
print(result.memories) # List of memory IDs
Search
results = client.search(
query="user preferences",
limit=10,
user_id="user123",
min_salience=0.5
)
for r in results.results:
print(f"ID: {r.id}")
print(f"Content: {r.content}")
print(f"Score: {r.score}")
print(f"Salience: {r.salience}")
List Memories
memories = client.list_memories(
limit=50,
offset=0,
user_id="user123",
sector="semantic"
)
for m in memories.memories:
print(f"{m.content} - {m.created_at}")
Delete Memory
client.delete_memory("memory-id-here")
Context Manager
with UniMemory(api_key="...") as client:
client.add_memory(content="...")
# Client is automatically closed after the block
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
unimemory-1.0.2.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unimemory-1.0.2.tar.gz.
File metadata
- Download URL: unimemory-1.0.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f804ea3b03bcf0fe6057edf0a62a9fc9e1bf4a4856b27892594fd62a450bfa89
|
|
| MD5 |
268d17e1998b119e3068d79ffdab4a18
|
|
| BLAKE2b-256 |
79204fd4516030324717dd9c48e44ac82e361106c00db93ee4493712e551025e
|
File details
Details for the file unimemory-1.0.2-py3-none-any.whl.
File metadata
- Download URL: unimemory-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7c5e107f4d06e2900b5b72effe5631ba7d9ac605365fe4e3e810460e04f3364
|
|
| MD5 |
ab8bd874c5b873111eec4674434f78fa
|
|
| BLAKE2b-256 |
412d7e2f7aefc99c06502115e2fff6686eba46c2eabf30f630315ee80cd154a5
|