test_indexing.py — langchain Source File
Architecture documentation for test_indexing.py, a python file in the langchain codebase. 14 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 215af82a_32c1_2580_82ac_662f473df50b["test_indexing.py"] cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] 215af82a_32c1_2580_82ac_662f473df50b --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 af34f08b_0ede_2b87_0db6_983d74ed0249["datetime"] 215af82a_32c1_2580_82ac_662f473df50b --> af34f08b_0ede_2b87_0db6_983d74ed0249 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 215af82a_32c1_2580_82ac_662f473df50b --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 525a7d6f_f455_56e3_854a_c8a7da4a1417["unittest.mock"] 215af82a_32c1_2580_82ac_662f473df50b --> 525a7d6f_f455_56e3_854a_c8a7da4a1417 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 215af82a_32c1_2580_82ac_662f473df50b --> 120e2591_3e15_b895_72b6_cb26195e40a6 a3f8313e_187d_b883_54b8_d68ee753b3c6["pytest_asyncio"] 215af82a_32c1_2580_82ac_662f473df50b --> a3f8313e_187d_b883_54b8_d68ee753b3c6 2a596110_eecb_6975_0f38_02fb4494758e["langchain_core.document_loaders"] 215af82a_32c1_2580_82ac_662f473df50b --> 2a596110_eecb_6975_0f38_02fb4494758e c554676d_b731_47b2_a98f_c1c2d537c0aa["langchain_core.documents"] 215af82a_32c1_2580_82ac_662f473df50b --> c554676d_b731_47b2_a98f_c1c2d537c0aa bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3["langchain_core.embeddings"] 215af82a_32c1_2580_82ac_662f473df50b --> bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3 ffb0de41_b0f2_997d_ad3d_1a29fba34ab1["langchain_core.indexing.api"] 215af82a_32c1_2580_82ac_662f473df50b --> ffb0de41_b0f2_997d_ad3d_1a29fba34ab1 d55af636_303c_0eb6_faee_20d89bd952d5["langchain_core.vectorstores"] 215af82a_32c1_2580_82ac_662f473df50b --> d55af636_303c_0eb6_faee_20d89bd952d5 91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"] 215af82a_32c1_2580_82ac_662f473df50b --> 91721f45_4909_e489_8c1f_084f8bd87145 519e8d2b_8825_7968_b59a_9a6fd29176d2["langchain_classic.indexes"] 215af82a_32c1_2580_82ac_662f473df50b --> 519e8d2b_8825_7968_b59a_9a6fd29176d2 1b0ae2ed_cca0_9671_eee5_f23b62c4f004["langchain_classic.indexes._sql_record_manager"] 215af82a_32c1_2580_82ac_662f473df50b --> 1b0ae2ed_cca0_9671_eee5_f23b62c4f004 style 215af82a_32c1_2580_82ac_662f473df50b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from collections.abc import AsyncIterator, Iterable, Iterator, Sequence
from datetime import datetime, timezone
from typing import (
Any,
)
from unittest.mock import patch
import pytest
import pytest_asyncio
from langchain_core.document_loaders import BaseLoader
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.indexing.api import _abatch, _get_document_with_hash
from langchain_core.vectorstores import VST, VectorStore
from typing_extensions import override
from langchain_classic.indexes import aindex, index
from langchain_classic.indexes._sql_record_manager import SQLRecordManager
class ToyLoader(BaseLoader):
"""Toy loader that always returns the same documents."""
def __init__(self, documents: Sequence[Document]) -> None:
"""Initialize with the documents to return."""
self.documents = documents
def lazy_load(
self,
) -> Iterator[Document]:
yield from self.documents
async def alazy_load(
self,
) -> AsyncIterator[Document]:
for document in self.documents:
yield document
class InMemoryVectorStore(VectorStore):
"""In-memory implementation of VectorStore using a dictionary."""
def __init__(self, *, permit_upserts: bool = False) -> None:
"""Vector store interface for testing things in memory."""
self.store: dict[str, Document] = {}
self.permit_upserts = permit_upserts
@override
def delete(self, ids: Sequence[str] | None = None, **kwargs: Any) -> None:
"""Delete the given documents from the store using their IDs."""
if ids:
for _id in ids:
self.store.pop(_id, None)
@override
async def adelete(self, ids: Sequence[str] | None = None, **kwargs: Any) -> None:
"""Delete the given documents from the store using their IDs."""
if ids:
for _id in ids:
self.store.pop(_id, None)
// ... (1488 more lines)
Domain
Subdomains
Functions
- _to_async_iter()
- arecord_manager()
- record_manager()
- test_abatch()
- test_adeduplication()
- test_aincremental_delete()
- test_aincremental_fails_with_bad_source_ids()
- test_aindex_simple_delete_full()
- test_aindexing_custom_batch_size()
- test_aindexing_force_update()
- test_aindexing_same_content()
- test_aindexing_with_no_docs()
- test_ano_delete()
- test_async_cleanup_with_different_batchsize()
- test_cleanup_with_different_batchsize()
- test_deduplication()
- test_deduplication_v2()
- test_incremental_delete()
- test_incremental_delete_with_batch_size()
- test_incremental_fails_with_bad_source_ids()
- test_incremental_indexing_with_batch_size()
- test_index_simple_delete_full()
- test_indexing_custom_batch_size()
- test_indexing_force_update()
- test_indexing_same_content()
- test_indexing_with_no_docs()
- test_no_delete()
- upserting_vector_store()
- vector_store()
Classes
Dependencies
- collections.abc
- datetime
- langchain_classic.indexes
- langchain_classic.indexes._sql_record_manager
- langchain_core.document_loaders
- langchain_core.documents
- langchain_core.embeddings
- langchain_core.indexing.api
- langchain_core.vectorstores
- pytest
- pytest_asyncio
- typing
- typing_extensions
- unittest.mock
Source
Frequently Asked Questions
What does test_indexing.py do?
test_indexing.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in test_indexing.py?
test_indexing.py defines 29 function(s): _to_async_iter, arecord_manager, record_manager, test_abatch, test_adeduplication, test_aincremental_delete, test_aincremental_fails_with_bad_source_ids, test_aindex_simple_delete_full, test_aindexing_custom_batch_size, test_aindexing_force_update, and 19 more.
What does test_indexing.py depend on?
test_indexing.py imports 14 module(s): collections.abc, datetime, langchain_classic.indexes, langchain_classic.indexes._sql_record_manager, langchain_core.document_loaders, langchain_core.documents, langchain_core.embeddings, langchain_core.indexing.api, and 6 more.
Where is test_indexing.py in the architecture?
test_indexing.py is located at libs/langchain/tests/unit_tests/indexes/test_indexing.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/langchain/tests/unit_tests/indexes).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free