â”‚ 6.0126      â”‚    â•°â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•¯It's important to note that we have not specified that the user, job, credit_score and age in the metadata should be fields within the index, this is because the Redis VectorStore object automatically generate the index schema from the passed metadata. For more information on the generation of index fields, see the API documentation.Queryingâ€‹There are multiple ways to query the Redis VectorStore implementation based on what use case you have:similarity_search: Find the most similar vectors to a given vector.similarity_search_with_score: Find the most similar vectors to a given vector and return the vector distancesimilarity_search_limit_score: Find the most similar vectors to a given vector and limit the number of results to the score_thresholdsimilarity_search_with_relevance_scores: Find the most similar vectors to a given vector and return the vector similaritiesmax_marginal_relevance_search: Find the most similar vectors to a given vector while also optimizing for diversityresults = rds.similarity_search("foo")print(results[0].page_content)    foo# return metadataresults = rds.similarity_search("foo", k=3)meta = results[1].metadataprint("Key of the document in Redis: ", meta.pop("id"))print("Metadata of the document: ", meta)    Key of the document in Redis:  doc:users:a70ca43b3a4e4168bae57c78753a200f    Metadata of the document:  {'user': 'derrick', 'job': 'doctor', 'credit_score': 'low', 'age': '45'}# with scores (distances)results = rds.similarity_search_with_score("foo", k=5)for result in results:    print(f"Content: {result[0].page_content} --- Score: {result[1]}")    Content: foo --- Score: 0.0    Content: foo --- Score: 0.0    Content: foo --- Score: 0.0    Content: bar --- Score: 0.1566    Content: bar --- Score: 0.1566# limit the vector distance that can be returnedresults =
Redis vector database introduction and langchain integration guide.
Redis vector database introduction and langchain integration guide. ->: â”‚ 6.0126      â”‚    â•°â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”´â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•¯It's important to note that we have not specified that the user, job, credit_score and age in the metadata should be fields within the index, this is because the Redis VectorStore object automatically generate the index schema from the passed metadata. For more information on the generation of index fields, see the API documentation.Queryingâ€‹There are multiple ways to query the Redis VectorStore implementation based on what use case you have:similarity_search: Find the most similar vectors to a given vector.similarity_search_with_score: Find the most similar vectors to a given vector and return the vector distancesimilarity_search_limit_score: Find the most similar vectors to a given vector and limit the number of results to the score_thresholdsimilarity_search_with_relevance_scores: Find the most similar vectors to a given vector and return the vector similaritiesmax_marginal_relevance_search: Find the most similar vectors to a given vector while also optimizing for diversityresults = rds.similarity_search("foo")print(results[0].page_content)    foo# return metadataresults = rds.similarity_search("foo", k=3)meta = results[1].metadataprint("Key of the document in Redis: ", meta.pop("id"))print("Metadata of the document: ", meta)    Key of the document in Redis:  doc:users:a70ca43b3a4e4168bae57c78753a200f    Metadata of the document:  {'user': 'derrick', 'job': 'doctor', 'credit_score': 'low', 'age': '45'}# with scores (distances)results = rds.similarity_search_with_score("foo", k=5)for result in results:    print(f"Content: {result[0].page_content} --- Score: {result[1]}")    Content: foo --- Score: 0.0    Content: foo --- Score: 0.0    Content: foo --- Score: 0.0    Content: bar --- Score: 0.1566    Content: bar --- Score: 0.1566# limit the vector distance that can be returnedresults =