Home / Class/ InMemoryVectorstoreWithSearch Class — langchain Architecture

InMemoryVectorstoreWithSearch Class — langchain Architecture

Architecture documentation for the InMemoryVectorstoreWithSearch class in test_parent_document.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  59f9846e_cf75_c281_0671_921ba43186ee["InMemoryVectorstoreWithSearch"]
  6e491709_d60f_689d_8a1a_c760b54fd120["InMemoryVectorStore"]
  59f9846e_cf75_c281_0671_921ba43186ee -->|extends| 6e491709_d60f_689d_8a1a_c760b54fd120
  4e15ad55_c408_dc34_ca57_6abbef12e843["test_parent_document.py"]
  59f9846e_cf75_c281_0671_921ba43186ee -->|defined in| 4e15ad55_c408_dc34_ca57_6abbef12e843
  8d811a0a_43fe_23ed_d2aa_54bb19acd1bb["similarity_search()"]
  59f9846e_cf75_c281_0671_921ba43186ee -->|method| 8d811a0a_43fe_23ed_d2aa_54bb19acd1bb
  ed386e23_38e4_7864_ed20_2e13bbca8501["add_documents()"]
  59f9846e_cf75_c281_0671_921ba43186ee -->|method| ed386e23_38e4_7864_ed20_2e13bbca8501

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/retrievers/test_parent_document.py lines 13–32

class InMemoryVectorstoreWithSearch(InMemoryVectorStore):
    @override
    def similarity_search(
        self,
        query: str,
        k: int = 4,
        **kwargs: Any,
    ) -> list[Document]:
        res = self.store.get(query)
        if res is None:
            return []
        return [res]

    @override
    def add_documents(self, documents: Sequence[Document], **kwargs: Any) -> list[str]:
        print(documents)  # noqa: T201
        return super().add_documents(
            documents,
            ids=[f"{i}" for i in range(len(documents))],
        )

Frequently Asked Questions

What is the InMemoryVectorstoreWithSearch class?
InMemoryVectorstoreWithSearch is a class in the langchain codebase, defined in libs/langchain/tests/unit_tests/retrievers/test_parent_document.py.
Where is InMemoryVectorstoreWithSearch defined?
InMemoryVectorstoreWithSearch is defined in libs/langchain/tests/unit_tests/retrievers/test_parent_document.py at line 13.
What does InMemoryVectorstoreWithSearch extend?
InMemoryVectorstoreWithSearch extends InMemoryVectorStore.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free