LangChain integration for Spokest Brain memory
Project description
spokest-langchain
LangChain memory integration for Spokest Brain. Give your LangChain chains persistent, associative memory powered by the Spokest Brain API.
Install
pip install spokest-langchain
Usage
from langchain_openai import ChatOpenAI
from langchain.chains import ConversationChain
from spokest_langchain import SpokestMemory
memory = SpokestMemory(
api_key="sk-your-spokest-api-key",
base_url="https://brain-api.spokest.com", # optional, this is the default
)
llm = ChatOpenAI(model="gpt-4o")
chain = ConversationChain(llm=llm, memory=memory)
response = chain.invoke({"input": "What did we discuss about the product launch?"})
print(response["response"])
Configuration
| Parameter | Default | Description |
|---|---|---|
api_key |
(required) | Your Spokest Brain API key |
base_url |
https://brain-api.spokest.com |
Brain API base URL |
memory_key |
memories |
Key used in the chain's memory variables |
How it works
load_memory_variables-- Calls/v1/memory/recallwith the current user input to retrieve relevant memories. Returns them formatted as a bulleted list under the configuredmemory_key.save_context-- Calls/v1/memory/storewith the full conversation turn (user input + assistant output) after each chain invocation.clear-- Logs a warning. Spokest Brain memories are permanent by design and cannot be deleted.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spokest_langchain-1.0.0.tar.gz.
File metadata
- Download URL: spokest_langchain-1.0.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
184fa6adba605e6c6f5ee284b9e8671c2a7f68a19da9ee87a430ddc54d77b94a
|
|
| MD5 |
9a228732b7fc9ff5338634018b47b45f
|
|
| BLAKE2b-256 |
8cceccc2f968e25cc4d74184ae5d47bf232b6f9c2a0e93d8606577217c5995f1
|
File details
Details for the file spokest_langchain-1.0.0-py3-none-any.whl.
File metadata
- Download URL: spokest_langchain-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86da01c773b9bacc2b3abdbfd1c88ab61b6ded7b4befd946fb798f1a68e0c557
|
|
| MD5 |
7d76ba66c6b23f8ad6048f54bd859ab9
|
|
| BLAKE2b-256 |
572e9c300a187fbf0f04c08870af945fee5e304025c7e1a1ea8595e59850f343
|