Metadata-Version: 2.4
Name: memryapi
Version: 1.0.0
Summary: Official Python SDK for MemryAPI — Memory-as-a-Service for AI Applications.
Project-URL: Homepage, https://memryapi.com
Project-URL: Repository, https://github.com/aanveshh35/MemoryAPI
Project-URL: Documentation, https://memryapi.com/docs
Author-email: MemryAPI <support@memryapi.com>
License: MIT
Keywords: agents,ai,llm,long-term-memory,memory,openai,rag
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24.0
Description-Content-Type: text/markdown

# MemryAPI Python SDK

The Sovereign Persistence Layer for AI Agents.

## Installation

```bash
pip install memryapi
```

## Quick Start

```python
from memryapi import MemryAPI

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

# Store a memory
client.remember("user-123", "Prefers dark chocolate over milk chocolate")

# Recall memories by semantic similarity
result = client.recall("user-123", "What chocolate do they like?")
print(result.results[0].content)
# → "Prefers dark chocolate over milk chocolate"
```

## Session Helper

Avoid repeating `user_id` on every call:

```python
session = client.session("user-123")

session.remember("Has a golden retriever named Max")
session.remember("Works remotely from Austin, TX")

memories = session.recall("pets")
summary = session.summarize()
```

## LLM Wrapper (Experimental)

Automatically inject memory context into your LLM calls:

```python
from openai import OpenAI

openai = OpenAI()

def ask(context: str) -> str:
    response = openai.chat.completions.create(
        model="gpt-4",
        messages=[
            {"role": "system", "content": f"User context:\n{context}"},
            {"role": "user", "content": "What should I get them for their birthday?"},
        ],
    )
    return response.choices[0].message.content

# Recalls memories, passes as context, saves the AI response
answer = client.wrap("user-123", ask, query="preferences interests")
```

## Context Manager

```python
with MemryAPI("your-api-key") as client:
    client.remember("user-123", "Some fact")
    result = client.recall("user-123", "query")
# HTTP client is automatically closed
```

## API Reference

| Method | Description |
|--------|-------------|
| `remember(user_id, text, metadata)` | Store a memory |
| `recall(user_id, query, top_k, threshold, time_weight)` | Semantic recall |
| `forget(memory_id)` | Delete a specific memory |
| `forget_all(user_id)` | Delete all user memories |
| `summarize(user_id, limit, save_as_memory)` | AI-powered summary |
| `session(user_id)` | Session-scoped client |
| `wrap(user_id, fn, query)` | Auto memory-augmented LLM calls |

## License

MIT
