UniMemory SDK - AI memory management for your applications
Project description
UniMemory
AI memory management for your applications.
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.0.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.0.tar.gz.
File metadata
- Download URL: unimemory-1.0.0.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 |
aa95e658e993cf1041d107c20ef1e90e98aa51630f9c0373187523e859b22ebe
|
|
| MD5 |
720e9ad8d31c84f8a2bc21b105d7234f
|
|
| BLAKE2b-256 |
57851fe3552f9b3e78e14085dc1ee76260a36dac397979f40660fc1fff546a7a
|
File details
Details for the file unimemory-1.0.0-py3-none-any.whl.
File metadata
- Download URL: unimemory-1.0.0-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 |
4460bd03acaa8800987dd802ecfe0696d174668f2a5dcba5fcccba1c7722fa46
|
|
| MD5 |
4983b214aa71ca0125fe4c65c27438ff
|
|
| BLAKE2b-256 |
74efc630ca4a6652f5c12f903785f5d552bf3835de490cb6ffbd3e925f5a66a7
|