Skip to main content

Alchemyst LangChain

Persistent memory for LangChain powered by Alchemyst AI.


Installation

pip install alchemyst-langchain

Quick Start

from alchemyst_langchain import AlchemystMemory
from langchain.chains import ConversationChain
from langchain_openai import ChatOpenAI

# Create persistent memory
memory = AlchemystMemory(
    api_key="your-alchemyst-api-key",
    session_id="user-123"
)

# Use with LangChain
llm = ChatOpenAI(model="gpt-4o-mini")
chain = ConversationChain(llm=llm, memory=memory)

# Chat
response = chain.invoke({"input": "My name is Alice"})
print(response['response'])

# Later... memory persists!
response = chain.invoke({"input": "What's my name?"})
print(response['response'])  # "Alice"

Features

  • 💾 Persistent Memory - Survives restarts
  • 🔗 LangChain Compatible - Drop-in replacement
  • 🚀 Easy Setup - 3 lines of code
  • 🔒 Session Isolation - Multi-user support
  • ✅ Production Ready - Tested and reliable

API

AlchemystMemory

memory = AlchemystMemory(
    api_key="your-key",      # Alchemyst AI API key
    session_id="user-123"    # Unique session identifier
)

Methods:

  • save_context(inputs, outputs) - Save conversation
  • load_memory_variables(inputs) - Load history
  • clear() - Clear session memory

Examples

Basic Usage

memory = AlchemystMemory(
    api_key="your-key",
    session_id="session-1"
)

chain = ConversationChain(llm=llm, memory=memory)
chain.invoke({"input": "Hello!"})

Multi-User Support

# Different users, different sessions
alice_memory = AlchemystMemory(api_key=key, session_id="alice")
bob_memory = AlchemystMemory(api_key=key, session_id="bob")

Clear Memory

# Delete session data
memory.clear()

Environment Setup

Create .env file:

ALCHEMYST_AI_API_KEY=your_api_key_here
OPENAI_API_KEY=your_openai_key_here

Development

# Install
pip install -e ".[dev]"

# Run tests
pytest

# Build
python -m build

Get API Key

Sign up at getalchemystai.com


Links


Metadata

Release files for alchemyst-langchain 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alchemyst-langchain 0.1.0
File Size Uploaded
alchemyst_langchain-0.1.0.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alchemyst-langchain 0.1.0
File Interpreter ABI Platform
alchemyst_langchain-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / alchemyst_langchain-0.1.0.tar.gz

Download URL alchemyst_langchain-0.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dba32e2707036e46a68948afaf29cd19ba0755bdf913f32d05311c77ebbad023
BLAKE2b-256 checksum
How to use checksums
2585d54a1e09b1b2022d0ebd3fa995312a8ad19448011db3b5d174789702297b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / alchemyst_langchain-0.1.0-py3-none-any.whl

Download URL alchemyst_langchain-0.1.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7beda78fe73be8c3b0941c4fa06327efdc0b72682faeb9bd49fde6be5c728ae0
BLAKE2b-256 checksum
How to use checksums
68e15791d50ed46f36d1d1ecdcff7f9199d41018b4109ff3a9b5fe670696580e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page