Skip to content

Conversation

ssh-esh
Copy link
Collaborator

@ssh-esh ssh-esh commented Oct 2, 2025

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 in langchain_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

@ssh-esh ssh-esh changed the title Add num dimensions vector store Add num dimensions and metadata_mappings to ElasticsearchStore Oct 2, 2025
@ssh-esh ssh-esh marked this pull request as ready for review October 2, 2025 23:32
@ssh-esh ssh-esh requested a review from miguelgrinberg October 2, 2025 23:32
@ssh-esh
Copy link
Collaborator Author

ssh-esh commented Oct 2, 2025

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

@ssh-esh ssh-esh removed the request for review from miguelgrinberg October 2, 2025 23:43
@ssh-esh ssh-esh marked this pull request as draft October 2, 2025 23:43
@ssh-esh ssh-esh changed the title Add num dimensions and metadata_mappings to ElasticsearchStore Add num dimensions and metadata_mappings to ElasticsearchStore with testing Oct 3, 2025
@ezimuel ezimuel self-requested a review October 3, 2025 14:27
Copy link
Collaborator

@ezimuel ezimuel left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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:
Copy link
Collaborator

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! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants