-
Notifications
You must be signed in to change notification settings - Fork 32
Get by ids #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Get by ids #25
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -490,6 +490,39 @@ def test_similarity_search(redis_url: str) -> None: | |
| vector_store.index.delete(drop=True) | ||
|
|
||
|
|
||
| def test_get_by_ids(redis_url: str) -> None: | ||
| """Test end to end construction and search.""" | ||
| # Create embeddings | ||
| embeddings = OpenAIEmbeddings() | ||
|
|
||
| # Create a unique index name for testing | ||
| index_name = f"test_index_{str(ULID())}" | ||
|
|
||
| texts = ["foo", "bar", "baz"] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's where there is a conceptual misunderstanding... You have keys as |
||
|
|
||
| keys = ["a", "b", "c"] | ||
|
|
||
| # Create the RedisVectorStore | ||
| vector_store = RedisVectorStore.from_texts( | ||
| texts, | ||
| embeddings, | ||
| index_name=index_name, | ||
| key_prefix="tst11", | ||
| redis_url=redis_url, | ||
| ) | ||
|
|
||
| ids = [f"tst11:{k}" for k in ["a","c"]] | ||
|
|
||
| docs = vector_store.get_by_ids(ids) | ||
|
|
||
| result_texts = [doc.page_content for doc in docs] | ||
|
|
||
| assert all(txt in result_texts for txt in texts) | ||
|
|
||
| # Clean up | ||
| vector_store.index.delete(drop=True) | ||
|
|
||
|
|
||
| def test_similarity_search_with_scores(redis_url: str) -> None: | ||
| """Test end to end construction and search.""" | ||
| # Create embeddings | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use a pipeline operation for this with
transaciton=FalseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tylerhutcherson What do you think about these changes?