Skip to content

Instantly share code, notes, and snippets.

@bsbodden
Created September 5, 2024 14:04
Show Gist options
  • Save bsbodden/01cc706a842df10ba683dbf10785c2fe to your computer and use it in GitHub Desktop.
Save bsbodden/01cc706a842df10ba683dbf10785c2fe to your computer and use it in GitHub Desktop.
langchain-redis with Sentinel connection
# 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