Registry / llm-agents / langchain-redis

langchain-redis

JSON →
library0.2.5pypypi✓ verified 85d ago

LangChain Redis provides integrations for using Redis as a vector store, chat message history, cache, and semantic cache with LangChain. Version 0.2.5 supports LangChain v1 and v2, uses redis-py 6.x and redisvl 0.4+. Compatible with Python 3.10-3.13. Released under MIT license by LangChain.

pip install langchain-redis
INSTALL
IMPORT
SIG · LANGCHAIN-REDIS
L
langchain-redis
llm-agentspythonv0.2.5
Install
10.0s avg
Import
2691ms
Disk
183MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 10.0s · import 2.691s · 182MB
183MB installed
● package 183MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RedisVectorStore
from langchain_redis import RedisVectorStore
from langchain_redis.vectorstores import RedisVectorStore
Incorrect import path removed in v0.1.0

Initializes a RedisVectorStore, adds documents, and performs similarity search. Requires a running Redis instance and OpenAI API key set as OPENAI_API_KEY.

import os from langchain_redis import RedisVectorStore, RedisConfig from langchain_core.documents import Document from langchain_openai import OpenAIEmbeddings redis_url = os.environ.get('REDIS_URL', 'redis://localhost:6379') embeddings = OpenAIEmbeddings(model="text-embedding-ada-002") config = RedisConfig(redis_url=redis_url) vector_store = RedisVectorStore(config, embeddings) docs = [ Document(page_content="LangChain is a framework for LLM apps", metadata={"category": "ai"}), Document(page_content="Redis is an in-memory data store", metadata={"category": "database"}) ] vector_store.add_documents(docs) results = vector_store.similarity_search("LLM framework", k=1) print(results[0].page_content)
Debug
Known issues
breakingUpgraded from Pydantic v1 to v2 in v0.1.0. Custom schemas using Pydantic v1 model validators may break.
fix
Update custom schemas to Pydantic v2 syntax (e.g., model_validator instead of root_validator).
affects: <0.1.0 -> >=0.1.0
breakingImport paths restructured in v0.2.0. Top-level imports like `from langchain_redis import RedisVectorStore` now required; deep imports (e.g., `from langchain_redis.vectorstores import RedisVectorStore`) removed.
fix
Use top-level imports from `langchain_redis`.
affects: <0.2.0 -> >=0.2.0
deprecatedRedisConfig.index_schema initialization changed in v0.1.0. Setting index_schema directly is deprecated; use `add_texts` or `create_index` with schema instead.
fix
Pass schema via `add_texts` method or use `RedisVectorStore.from_texts`.
affects: >=0.1.0
gotchaRedisVectorStore.add_texts ignores the `ids` parameter if provided. This is a known bug fixed in v0.2.2.
fix
Upgrade to v0.2.2 or later, or use `add_documents` with Document objects that have explicit IDs.
affects: >=0.2.0, <0.2.2
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'langchain_redis'
Package not installed or import name mismatch (old import path `langchain_redis` vs `langchain.redis`).
fix
Run `pip install langchain-redis` and use `from langchain_redis import RedisVectorStore`.
redis.exceptions.ResponseError: Unknown index name
The specified Redis index does not exist or was not created before querying.
fix
Ensure the index is created by calling `vector_store.create_index()` or using `add_texts` first. Verify index name spelling.
pydantic.errors.PydanticInvalidForJsonSchema
Using Pydantic v1 custom schema with langchain-redis v0.1.0+ which requires Pydantic v2.
fix
Migrate custom schemas to Pydantic v2 syntax. See Pydantic migration guide.
Upgrade
Version history
0.2.5latest on PyPI · released Nov 25, 2025
Audit
Dependencies
langchain-corerequiredCore dependency for all integrations
redisrequiredRedis client library
redisvlrequiredRedis vector library for vector store and semantic cache
numpyrequiredRequired for vector operations
Agent activity
40 hits · last 30 days
node
36
OpenAI (training)
1
Resources
langchain-redis — pip install langchain-redis · libregistry