-
Notifications
You must be signed in to change notification settings - Fork 24
Add num dimensions and metadata_mappings to ElasticsearchStore with testing #75
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?
Add num dimensions and metadata_mappings to ElasticsearchStore with testing #75
Conversation
…and proper assertions
CI was passing but things are failing after my last commit (which was just a comment change). I am converting this to draft and deal with it tomorrow. I think it has to do with some tests still using FakeEmbeddings instead of our new ConsistentFakeEmbeddings which using determinstic hash based embeddings. It might be worth making a separate issue/PR to update all the FakeEmbeddings to use the new one and remove it entirely to avoid this random behaviour |
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.
I left just have some minor comments. Very good PR and a special mention for the test_parameter_forwarding_to_evectorstore
test, really sweat!
parameters, this test will fail and alert us to update AsyncElasticsearchStore. | ||
""" | ||
import inspect | ||
from unittest.mock import AsyncMock, patch |
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.
The AsyncMock
class is is already imported at the beginning of the file. Moreover, it's better to specify all the imports at the beginning of the file (see. PEP 8).
async def test_parameter_forwarding_defaults(self) -> None: | ||
"""Test that default parameter values are properly forwarded to | ||
AsyncEVectorStore.""" | ||
from unittest.mock import AsyncMock, patch |
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.
Same comment as before.
ElasticsearchStore actually forwards. If EVectorStore adds new | ||
parameters, this test will fail and alert us to update ElasticsearchStore. | ||
""" | ||
import inspect |
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.
Same comment as before
def test_parameter_forwarding_defaults(self) -> None: | ||
"""Test that default parameter values are properly forwarded to | ||
EVectorStore.""" | ||
from unittest.mock import Mock, patch |
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.
Same comment as before
hybrid_store.similarity_search_by_vector_with_relevance_scores([1, 2, 3]) | ||
|
||
@pytest.mark.sync | ||
def test_parameter_forwarding_to_evectorstore(self) -> None: |
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.
This is a very nice test! 🥇
Issue(s)
Closes #69
Closes #76
Description
Adds num_dimensions and another missing param of metadata_mappings (the tests below I included caught this second missing param and i made issue above
metadata_mappings
is not supported inlangchain_elasticsearch.ElasticsearchStore
#76 )Adds tests to detect missing params discrepancy between ElasticsearchStore and EVectorStore to catch these early in the future
Adds tests to make sure num_dimensions is working properly with integeration tests
Adds tests to check that metadata_mappings is working as expected with integeration tests