Replies: 1 comment 2 replies
-
To instantiate a Redis vector store with a custom index schema and vector schema, you need to override the default "content" and "content_vectors" values by specifying your custom vector field name "description_vector". Here's how you can do it:
Here's an example code snippet: from langchain_community.vectorstores.redis.base import Redis
# Define your custom vector schema
custom_vector_schema = {
"name": "description_vector", # Your custom vector field name
"algorithm": "FLAT",
"dims": 1536, # Ensure this matches your embedding dimensions
"distance_metric": "COSINE",
"datatype": "FLOAT32",
}
# Create the Redis instance with the custom vector schema
rds = Redis.from_texts(
texts, # a list of strings
metadata, # a list of metadata dicts
embeddings, # an Embeddings object
vector_schema=custom_vector_schema, # Pass the custom vector schema here
redis_url="redis://localhost:6379",
) This setup should help you override the default settings and use your custom vector field "description_vector" [1]. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to instantiate the redis vector store for my pre existing index in redis.
It's vector field is named description_vector and there are other text fields that need to be retrieved.
I am landing up with the error :
langchain_community/vectorstores/redis/schema.py
ValueError("No content_vector field found")
I am looking for the correct way to instantiate the vector store so that all the default values for "content" and "content_vectors" are overrriden.
Beta Was this translation helpful? Give feedback.
All reactions