Skip to main content

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/recall with the current user input to retrieve relevant memories. Returns them formatted as a bulleted list under the configured memory_key.
  • save_context -- Calls /v1/memory/store with 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

Metadata

Release files for spokest-langchain 1.0.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 spokest-langchain 1.0.0
File Size Uploaded
spokest_langchain-1.0.0.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spokest-langchain 1.0.0
File Interpreter ABI Platform
spokest_langchain-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / spokest_langchain-1.0.0.tar.gz

Download URL spokest_langchain-1.0.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
184fa6adba605e6c6f5ee284b9e8671c2a7f68a19da9ee87a430ddc54d77b94a
BLAKE2b-256 checksum
How to use checksums
8cceccc2f968e25cc4d74184ae5d47bf232b6f9c2a0e93d8606577217c5995f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / spokest_langchain-1.0.0-py3-none-any.whl

Download URL spokest_langchain-1.0.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86da01c773b9bacc2b3abdbfd1c88ab61b6ded7b4befd946fb798f1a68e0c557
BLAKE2b-256 checksum
How to use checksums
572e9c300a187fbf0f04c08870af945fee5e304025c7e1a1ea8595e59850f343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.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