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.2.2.tar.gz (4.1 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.2.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: recallio-1.2.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for recallio-1.2.2.tar.gz
Algorithm Hash digest
SHA256 3de9e3df5b6b5ecaff397ee227544a50c26caaf812f49be236217c100e4882c5
MD5 9e61d394823093180bde03c7f9e3370f
BLAKE2b-256 cf51d0b319dad0caadc038a22be0d8abbd324beb8fa6d50514d325c2cb704873

See more details on using hashes here.

File details

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

File metadata

  • Download URL: recallio-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b961672397a891e66f462c052f65b0bd3e35f1a0aef630b59f2c996b6134d73
MD5 5dd08519cce2ad1980215232b330fa91
BLAKE2b-256 3c5b5da03b44bc629eb07728f07bd489a628c71286114dc507186928575434db

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