User Client
The UserClient is a user-scoped client returned by client.for_user(). All memory operations are automatically scoped to this user.
Creating a user client
user = client.for_user("user-123")Methods
remember(content)
Store content as memory. Automatically extracts entities and relationships.
# Simple text
result = user.remember("Alice is a software engineer who uses Python")
# Multiple items
result = user.remember(["First fact", "Second fact"])
# Document object
from memorer import Document
result = user.remember(Document(content="...", metadata={"source": "chat"}))| Parameter | Type | Description |
|---|---|---|
content | str | dict | Document | list | Content to remember. Accepts a string, dict with content key, Document object, or a list of any of these |
Returns: IngestResponse with fields:
entities_created— Number of entities extractedrelationships_created— Number of relationships createdepisodes_created— Number of temporal episodes createdprocessing_time_ms— Processing time in millisecondsstatus—"success"
recall(query, **kwargs)
Query memory using semantic similarity and optional graph reasoning.
results = user.recall("What does Alice do?")
print(results.context) # Assembled context string for LLM prompts
for r in results:
print(f"{r.content} (score: {r.relevance_score})")| Parameter | Type | Default | Description |
|---|---|---|---|
query | str | — | Natural language search query |
top_k | int | 10 | Maximum number of results |
use_emotional_ranking | bool | True | Apply emotional scoring |
use_graph_reasoning | bool | False | Enable multi-hop graph traversal |
graph_max_hops | int | 3 | Maximum traversal depth |
Returns: QueryResponse — iterable of QueryResult objects with a .context property containing assembled text for LLM prompts.
forget(memory_id)
Soft-delete a specific memory.
user.forget("memory-uuid-here")conversation(session_id)
Get or create a conversation session.
# Create a new conversation
conv = user.conversation()
# Resume an existing conversation
conv = user.conversation("existing-conversation-id")
conv.add("user", "Hello!")
result = conv.recall("what did we talk about?")| Parameter | Type | Default | Description |
|---|---|---|---|
session_id | str | None | None | Conversation ID. If None, creates a new conversation |
Returns: ConversationClient
Resource Attributes
| Property | Type | Description |
|---|---|---|
user.knowledge | KnowledgeResource | Knowledge graph query and ingestion |
user.memories | MemoriesResource | Memory CRUD and stats |
user.entities | EntitiesResource | Entity management |
user.conversations | ConversationsResource | Conversation session management |
Last updated on