Skip to main content

A pluggable memory layer for LLM apps

Project description

Recall SDK

PyPI version Python

Recall is a pluggable memory layer for LLM applications. It enables long-term memory by extracting, storing, and retrieving relevant information from user input, and injecting it back into prompts. Compatible with any OpenAI-style API.


Overview

Recall SDK gives your LLM apps long-term memory. It:

  • Extracts memory-worthy facts from user input
  • Stores them with TTL, tags, importance, and source
  • Injects relevant context into future prompts

It works with any OpenAI-compatible LLM API (OpenAI, Groq, etc.).


Installation

pip install recall-sdk

Quickstart

from recall import withrecall
from recall.memory import MemoryStore
from recall.llm.llm_client import create_openai_client

llm = create_openai_client(
    api_key="your-key",
    base_url="https://api.groq.com/openai/v1",
    model="mixtral-8x7b-32768"
)

store = MemoryStore()

with_recall = withrecall(llm=llm, store=store)
response = with_recall.chat("My dog's name is Ollie.")
print(response)

with_recall.remember("I live in Berlin.", tags=["location"], importance=0.8)

High Level API: withrecall()

Contructor

with_recall = withrecall(
    llm,                 # Callable that takes prompt and optional system_prompt
    store,               # MemoryStore instance
    user_id="default",   # Optional session/user ID
    strategy="always",   # Extraction strategy: always, batch
    metadata=None        # Optional metadata passed to handler
)

Methods

with_recall.chat(message: str) -> str

Extracts memory, injects relevant context, returns LLM response.

chat.remember(content: str, tags: List[str] = [], importance: float = 0.5)

Manually store memory entries.

Low-Level API (for more granular control over the memory)

Memory Store

from recall.memory import MemoryStore

store = MemoryStore()

store.add_memory(MemoryEntry(...))
store.get_memories("user-id")
store.export_memories("user-id", path="backup.json")
store.import_memories(data)

Memory Entry

from recall.memory import MemoryEntry

MemoryEntry(
    user_id="user-id",
    content="The Eiffel Tower is in Paris.",
    tags=["travel"],
    importance=0.9
)

Extraction Strategies

  • "always" : Extract memory from every message sent by the user [an extra LLM call to create a memory from the user's prompt and store it in the Memory]
  • "batch" : Extract memory every N messages [meta data controlled] [an extra LLM call after every N messages. This call uses all previous user prompts to get MemoryEntries]
  • "heuristic" : TBD

Memory Structure

Memory Structure Each memory is stored with:

  • id (UUID)
  • user_id
  • content
  • created_at
  • last_accessed
  • tags (list of strings)
  • importance (float 0–1)
  • ttl_days (time to live)
  • source (chatbot, manual, etc.)
  • embedding (To be integrated with high level API in future for semantic search)

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

recall_sdk-0.2.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

recall_sdk-0.2.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file recall_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: recall_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for recall_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 961691cbc11e83d572a1d3dd1f9eda2470ec3716206d97bbe891e4e61eebb73d
MD5 abb3d4e7d9a4c96610c388f1cddcdef8
BLAKE2b-256 0bbaa4f99d264dc5526d9510d219f5d7b500aef9344d9fe34a9113d9ff91b13a

See more details on using hashes here.

File details

Details for the file recall_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: recall_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for recall_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01d97b88b1be4466ec066b29907c6461df8cf4dc5c5e2e874167e1639d6b74af
MD5 83bd4ac96042d205ca200dedbebe17e3
BLAKE2b-256 ecfa04acf61514c4736c41e2c972efd1eb95502ddbdcde10621077edbc18d56e

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