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 epicode-sdk

Quick Start

from epicode 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 epicode 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 epicode 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

epicode_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.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: epicode_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 epicode_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a3388d528916865d702dce06c954a779ecc7b9f04a788d6e255c8bc9a5546bf2
MD5 81208efe94a9f50322beea1b22484e26
BLAKE2b-256 d74ded12da1b9162d88802890e11bf656ad02988a9a4abd365b1ccef9a98df2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epicode_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 epicode_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcec314f9ea8998d48b4049087666a9a033a3e582e37000074a900d36a95de51
MD5 4351af47e249cd258d55739285b69f93
BLAKE2b-256 4eab41162a4ebab2693d636c292f4ad488d98473072068df66a1eeb1e0691b6a

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