Created
September 5, 2024 14:04
-
-
Save bsbodden/01cc706a842df10ba683dbf10785c2fe to your computer and use it in GitHub Desktop.
langchain-redis with Sentinel connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# establish a Sentinel connection | |
from redis import Sentinel | |
sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1) | |
index_name = f"test_index_{str(ULID())}" | |
store = RedisVectorStore.from_texts( | |
texts, | |
OpenAIEmbeddings(), | |
index_name=index_name, | |
key_prefix="tst1", | |
redis_client=sentinel, | |
) | |
# ... work with the store |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment