Python client for the Recallio API
Project description
Recallio Python Client
A lightweight Python wrapper for the Recallio API.
Installation
pip install recallio
Usage
from recallio import (
RecallioClient,
MemoryWriteRequest,
MemoryRecallRequest,
RecallSummaryRequest,
GraphAddRequest,
GraphSearchRequest,
MemoryExportRequest,
)
client = RecallioClient(api_key="YOUR_RECALLIO_API_KEY")
req = MemoryWriteRequest(
userId="user_123",
projectId="project_abc",
content="The user prefers dark mode and wants notifications disabled on weekends",
consentFlag=True,
)
memory = client.write_memory(req)
print(memory.id)
# recall memories
recall_req = MemoryRecallRequest(
projectId="project_abc",
userId="user_123",
query="dark mode",
scope="user",
reRank=True,
)
results = client.recall_memory(recall_req)
for m in results:
print(m.content, m.similarityScore)
# summarized recall
summary_req = RecallSummaryRequest(
projectId="project_abc",
userId="user_123",
scope="user",
)
summary = client.recall_summary(summary_req)
print(summary.content)
# add data to the knowledge graph
graph_req = GraphAddRequest(
data="John works at OpenAI in San Francisco",
user_id="user_123",
project_id="project_abc",
)
client.add_graph_memory(graph_req)
# search the graph
search_req = GraphSearchRequest(
query="Where does John work?",
user_id="user_123",
)
graph_results = client.search_graph_memory(search_req)
for r in graph_results:
print(r.source, r.relationship, r.destination)
# export memories as JSON
export_req = MemoryExportRequest(
type="fact",
format="json",
userId="user_123",
)
json_data = client.export_memory(export_req)
print(json_data)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
recallio-1.1.3.tar.gz
(3.9 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 recallio-1.1.3.tar.gz.
File metadata
- Download URL: recallio-1.1.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cd96b59634148506ce42d704d04e6c727a2808055d066d61cac11aa2f72ce78
|
|
| MD5 |
cd4ee59c850a726a1eb8737f78bae1b5
|
|
| BLAKE2b-256 |
3bb90d1d87dfe414888b20323054dabb6c29fce0c91d8deaa66df07aa616b3fe
|
File details
Details for the file recallio-1.1.3-py3-none-any.whl.
File metadata
- Download URL: recallio-1.1.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7acb6a5f989b1c37586ca1ce4d8358606b1b052857987b77852ee6b684696fc8
|
|
| MD5 |
79a645dc3af9ab82e910ee50d13187ed
|
|
| BLAKE2b-256 |
c11bfde7919496ece40593ede5edcfea357ca28c409183cffb01c8c20e536055
|