Skip to main content

Python SDK for the Epicode API — spatial AI memory system

Project description

Epicode SDK for Python

Python client library for the Epicode API.

Installation

pip install tetramem-sdk

Quick Start

from tetramem import EpicodeClient

client = EpicodeClient("your-api-key")

# Store a memory
mem = client.remember("The project deadline is June 15.")
print(mem.id, mem.labels)

# Search memories
results = client.search("deadline", limit=5)
for r in results.results:
    print(r.content, r.similarity)

# Recall associative memories
recall = client.recall("project timeline", depth=3)
print(recall.seed_count, recall.emotion.pleasure)

# Ask a question
answer = client.ask("When is the deadline?")
print(answer.answer)

# Get account stats
stats = client.stats()
print(stats.memories_used, "/", stats.max_memories)

# Knowledge graph
node = client.create_node("Python 3.12 released", labels=["python", "release"])
node_data = client.get_node(node.id)
knowledge = client.knowledge(node.id)

# Timeline
tl = client.timeline()
print(tl.total, "events")

client.close()

Context Manager

with EpicodeClient("your-api-key") as client:
    health = client.health()
    print(health.status, health.version)

Admin API

from tetramem import EpicodeAdmin

admin = EpicodeAdmin("your-admin-key")

# Register a new user
user = admin.register("alice", plan="pro")
print(user.api_key, user.max_memories)

# List users
users = admin.list_users()
print(users.total_users, users.active_engines)

# Global stats
stats = admin.get_stats()
print(stats.max_users)

admin.close()

Error Handling

from tetramem import EpicodeClient, AuthenticationError, PlanLimitExceededError

client = EpicodeClient("invalid-key")

try:
    client.remember("test")
except AuthenticationError:
    print("Invalid API key")
except PlanLimitExceededError:
    print("Memory limit reached")

Configuration

client = EpicodeClient(
    "your-api-key",
    base_url="http://localhost:9111",  # default
    timeout=60,                                 # seconds, default 30
)

Requirements

  • Python >= 3.10
  • requests >= 2.28

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

tetramem_sdk-1.0.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

tetramem_sdk-1.0.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file tetramem_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: tetramem_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for tetramem_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 85ccb7e1c15e6ed3792081024d33d5f60d4317151c394e473c20fbb9f4b7c2c3
MD5 726ad871d728819366b64d38f58530a8
BLAKE2b-256 3401deb58fdbed7aaaa16b376301bd2120fb4c60961cc7f2e01640ee65197153

See more details on using hashes here.

File details

Details for the file tetramem_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tetramem_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for tetramem_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b86defa1076ed4f0f30d043355699bc775b14084dc3c76e9fb3f0dec0355523
MD5 6b981cedb439080a752bf799d459ab2d
BLAKE2b-256 17be444a476a535b9fcf1ae061b5ece8e8a4693b355c6dd03410a0931b082522

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