Skip to main content

Seizn - AI Memory Infrastructure for Developers

Project description

Seizn Python SDK

AI Memory Infrastructure for Developers.

Installation

pip install seizn

Quick Start

from seizn import Seizn

# Initialize client
client = Seizn(api_key="sk_your_api_key")

# Add a memory
memory = client.add(
    content="User prefers dark mode and uses TypeScript",
    memory_type="preference",
    tags=["ui", "tech"]
)

# Search memories
results = client.search("user preferences", limit=5)
for result in results:
    print(f"{result.content} (similarity: {result.similarity:.2f})")

# Extract memories from conversation
memories = client.extract("""
User: I'm a software engineer at Google.
Assistant: What do you work on?
User: Machine learning infrastructure, mostly Python and TensorFlow.
""")

# Query with memory context (RAG)
response = client.query("What programming languages does the user know?")
print(response.response)

Features

Memory Operations

# Add memory
memory = client.add("User lives in Seoul", memory_type="fact")

# Get memory
memory = client.get("memory-uuid")

# Update memory
memory = client.update("memory-uuid", tags=["location"], importance=8)

# Delete memory
client.delete("memory-uuid")

# Search with different modes
results = client.search("query", mode="vector")   # Semantic search
results = client.search("query", mode="keyword")  # BM25 search
results = client.search("query", mode="hybrid")   # Combined

AI Operations

# Extract memories from conversation
memories = client.extract(conversation_text, model="haiku", auto_store=True)

# RAG query
response = client.query("What do you know about me?", top_k=5)
print(response.response)
print(response.memories_used)

# Summarize conversation
summary = client.summarize([
    {"role": "user", "content": "Hello!"},
    {"role": "assistant", "content": "Hi there!"},
])
print(summary.text)
print(summary.key_points)

Webhooks

# Create webhook
webhook = client.create_webhook(
    name="My Webhook",
    url="https://example.com/webhook",
    events=["memory.created", "memory.deleted"]
)
print(f"Secret: {webhook.secret}")  # Save this!

# List webhooks
webhooks = client.list_webhooks()

# Delete webhook
client.delete_webhook("webhook-uuid")

Error Handling

from seizn import Seizn, SeiznError

client = Seizn(api_key="sk_...")

try:
    memory = client.get("invalid-uuid")
except SeiznError as e:
    print(f"Error: {e.message}")
    print(f"Status: {e.status_code}")

Context Manager

with Seizn(api_key="sk_...") as client:
    client.add("Memory content")
# Connection automatically closed

Configuration

client = Seizn(
    api_key="sk_...",
    base_url="https://api.seizn.dev",  # Custom endpoint
    timeout=30.0,  # Request timeout
)

## Async Support

For high-performance applications, use the async client:

```python
from seizn import AsyncSeizn
import asyncio

async def main():
    async with AsyncSeizn(api_key="sk_...") as client:
        # Add a single memory
        memory = await client.add("User prefers dark mode")

        # Batch add multiple memories (parallel)
        memories = await client.add_many([
            {"content": "Fact 1", "memory_type": "fact", "tags": ["tag1"]},
            {"content": "Fact 2", "memory_type": "fact", "tags": ["tag2"]},
            {"content": "Preference 1", "memory_type": "preference"},
        ])

        # Search and query
        results = await client.search("user preferences")
        response = await client.query("What are the user's preferences?")

asyncio.run(main())

Async Features

  • Parallel batch operations: add_many() adds multiple memories concurrently
  • Auto retry with exponential backoff: Handles transient failures automatically
  • Connection pooling: Efficient HTTP connection management
# Configure retries
client = AsyncSeizn(
    api_key="sk_...",
    retries=5,          # Number of retry attempts
    retry_delay=1.0,    # Base delay (uses exponential backoff)
)

Models Used

  • Embedding: Voyage-3 (1024 dimensions)
  • Extraction/Query: Claude 3.5 Haiku or Claude Sonnet 4

Links

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

seizn-0.3.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

seizn-0.3.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file seizn-0.3.0.tar.gz.

File metadata

  • Download URL: seizn-0.3.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for seizn-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b566c280e0103cf69b2c56e591be1e181c798aaa922030d00200890960f9fb8a
MD5 fd4821d4523a419a34b7f18d31d21568
BLAKE2b-256 18b31b66fa7781b687bb417bf1d7ec7a7320b327d4a4bd6418c2237b86223d27

See more details on using hashes here.

File details

Details for the file seizn-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: seizn-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for seizn-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f34e87a6a007b74b666cb87ca3093a02c777faac09064c83a74a8ef102c5d91c
MD5 0db2ec8b625ea45a9b7d9616c8355f94
BLAKE2b-256 209b96858526f32dddd6dbd417f84cb79ed4d85d8582bb335692bcae5c035723

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