Skip to main content

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.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

recallio-1.1.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file recallio-1.1.2.tar.gz.

File metadata

  • Download URL: recallio-1.1.2.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

Hashes for recallio-1.1.2.tar.gz
Algorithm Hash digest
SHA256 43f875535194bc4214ad1c0f983e59203cd6eadce873d276a4761e37291b8754
MD5 0024433af6678801494440148ca303b7
BLAKE2b-256 1263671372d3df809560a59b8d171cfdc43ec4c6e5caab2424af5bb3ac05f838

See more details on using hashes here.

File details

Details for the file recallio-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: recallio-1.1.2-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

Hashes for recallio-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 35bdaa186dc6f547d60d8634fbe60fea444f9beae6cb3f46baf596db234e7f40
MD5 e4322cbf10d71d7d3c91202c5c29a325
BLAKE2b-256 3f672296ce83f85162a1874fe95ad14214eca154e4d1810e7e5bc308265a2ee6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page