VectorStoreIntegrationTests Class — langchain Architecture
Architecture documentation for the VectorStoreIntegrationTests class in vectorstores.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6b7f515d_5b14_acff_3191_2493436e519d["VectorStoreIntegrationTests"] 2d95e59f_5168_1366_c8c2_e21e157938b5["BaseStandardTests"] 6b7f515d_5b14_acff_3191_2493436e519d -->|extends| 2d95e59f_5168_1366_c8c2_e21e157938b5 66f80d15_3263_dd06_0daa_dc7689e1102c["vectorstores.py"] 6b7f515d_5b14_acff_3191_2493436e519d -->|defined in| 66f80d15_3263_dd06_0daa_dc7689e1102c f37366a1_a972_3a9d_28a9_b0ccbfb446b0["vectorstore()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| f37366a1_a972_3a9d_28a9_b0ccbfb446b0 373035f6_51e2_6d60_ea79_6796426c1345["has_sync()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| 373035f6_51e2_6d60_ea79_6796426c1345 e3a0b19d_8796_4fb9_96b1_4f6f19e0a2af["has_async()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| e3a0b19d_8796_4fb9_96b1_4f6f19e0a2af c509032a_5234_60e4_9090_cf461c5a7aee["has_get_by_ids()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| c509032a_5234_60e4_9090_cf461c5a7aee 181ef22d_b1c2_1bc3_fc3f_0c2fbc9655f0["get_embeddings()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| 181ef22d_b1c2_1bc3_fc3f_0c2fbc9655f0 102aa157_92d6_e63a_bc4f_866f81772e4f["test_vectorstore_is_empty()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| 102aa157_92d6_e63a_bc4f_866f81772e4f f99b2444_6d52_a657_8341_121f68110c47["test_add_documents()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| f99b2444_6d52_a657_8341_121f68110c47 874b1b1d_cb10_08ac_a04d_8e02e69206ac["test_vectorstore_still_empty()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| 874b1b1d_cb10_08ac_a04d_8e02e69206ac af2e773a_b1e4_05d0_8c96_01b3fbd074a6["test_deleting_documents()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| af2e773a_b1e4_05d0_8c96_01b3fbd074a6 90b4efa0_d801_145e_5873_029594497394["test_deleting_bulk_documents()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| 90b4efa0_d801_145e_5873_029594497394 94eb1fcd_69c8_ce4e_0769_c5339abf5707["test_delete_missing_content()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| 94eb1fcd_69c8_ce4e_0769_c5339abf5707 61b3053d_a5aa_c68a_9b27_ee6a51c98d1b["test_add_documents_with_ids_is_idempotent()"] 6b7f515d_5b14_acff_3191_2493436e519d -->|method| 61b3053d_a5aa_c68a_9b27_ee6a51c98d1b
Relationship Graph
Source Code
libs/standard-tests/langchain_tests/integration_tests/vectorstores.py lines 21–842
class VectorStoreIntegrationTests(BaseStandardTests):
"""Base class for vector store integration tests.
Implementers should subclass this test suite and provide a fixture
that returns an empty vector store for each test.
The fixture should use the `get_embeddings` method to get a pre-defined
embeddings model that should be used for this test suite.
Here is a template:
```python
from typing import Generator
import pytest
from langchain_core.vectorstores import VectorStore
from langchain_parrot_link.vectorstores import ParrotVectorStore
from langchain_tests.integration_tests.vectorstores import VectorStoreIntegrationTests
class TestParrotVectorStore(VectorStoreIntegrationTests):
@pytest.fixture()
def vectorstore(self) -> Generator[VectorStore, None, None]: # type: ignore
\"\"\"Get an empty vectorstore.\"\"\"
store = ParrotVectorStore(self.get_embeddings())
# note: store should be EMPTY at this point
# if you need to delete data, you may do so here
try:
yield store
finally:
# cleanup operations, or deleting data
pass
```
In the fixture, before the `yield` we instantiate an empty vector store. In the
`finally` block, we call whatever logic is necessary to bring the vector store
to a clean state.
```python
from typing import Generator
import pytest
from langchain_core.vectorstores import VectorStore
from langchain_tests.integration_tests.vectorstores import VectorStoreIntegrationTests
from langchain_chroma import Chroma
class TestChromaStandard(VectorStoreIntegrationTests):
@pytest.fixture()
def vectorstore(self) -> Generator[VectorStore, None, None]: # type: ignore
\"\"\"Get an empty VectorStore for unit tests.\"\"\"
store = Chroma(embedding_function=self.get_embeddings())
try:
yield store
finally:
store.delete_collection()
pass
```
Note that by default we enable both sync and async tests. To disable either,
override the `has_sync` or `has_async` properties to `False` in the
subclass. For example:
```python
class TestParrotVectorStore(VectorStoreIntegrationTests):
@pytest.fixture()
def vectorstore(self) -> Generator[VectorStore, None, None]: # type: ignore
...
@property
def has_async(self) -> bool:
return False
```
!!! note
API references for individual test methods include troubleshooting tips.
""" # noqa: E501
@abstractmethod
@pytest.fixture
Extends
Source
Frequently Asked Questions
What is the VectorStoreIntegrationTests class?
VectorStoreIntegrationTests is a class in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/vectorstores.py.
Where is VectorStoreIntegrationTests defined?
VectorStoreIntegrationTests is defined in libs/standard-tests/langchain_tests/integration_tests/vectorstores.py at line 21.
What does VectorStoreIntegrationTests extend?
VectorStoreIntegrationTests extends BaseStandardTests.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free