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 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978["test_indexing.py"] cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 af34f08b_0ede_2b87_0db6_983d74ed0249["datetime"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> af34f08b_0ede_2b87_0db6_983d74ed0249 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 525a7d6f_f455_56e3_854a_c8a7da4a1417["unittest.mock"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> 525a7d6f_f455_56e3_854a_c8a7da4a1417 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> 120e2591_3e15_b895_72b6_cb26195e40a6 a3f8313e_187d_b883_54b8_d68ee753b3c6["pytest_asyncio"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> a3f8313e_187d_b883_54b8_d68ee753b3c6 2e073793_7bdb_2272_3b6f_82c878fdc38c["pytest_mock"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> 2e073793_7bdb_2272_3b6f_82c878fdc38c bc0c97a0_93eb_cfbc_6044_05825b687ba4["langchain_core.document_loaders.base"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> bc0c97a0_93eb_cfbc_6044_05825b687ba4 c554676d_b731_47b2_a98f_c1c2d537c0aa["langchain_core.documents"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> c554676d_b731_47b2_a98f_c1c2d537c0aa bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3["langchain_core.embeddings"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> bc46b61d_cfdf_3f6b_a9dd_ac2a328d84b3 a8fcc022_dc2b_29f4_4e44_b5c75941d529["langchain_core.indexing"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> a8fcc022_dc2b_29f4_4e44_b5c75941d529 ffb0de41_b0f2_997d_ad3d_1a29fba34ab1["langchain_core.indexing.api"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> ffb0de41_b0f2_997d_ad3d_1a29fba34ab1 f1b2b0eb_f384_a14e_5d97_566a3e577cd5["langchain_core.indexing.in_memory"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> f1b2b0eb_f384_a14e_5d97_566a3e577cd5 d55af636_303c_0eb6_faee_20d89bd952d5["langchain_core.vectorstores"] 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 --> d55af636_303c_0eb6_faee_20d89bd952d5 style 576ad89d_c8dc_eddf_9cd2_c8ae0e7c9978 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 AsyncMock, MagicMock, patch
import pytest
import pytest_asyncio
from pytest_mock import MockerFixture
from langchain_core.document_loaders.base import BaseLoader
from langchain_core.documents import Document
from langchain_core.embeddings import DeterministicFakeEmbedding
from langchain_core.indexing import InMemoryRecordManager, aindex, index
from langchain_core.indexing.api import (
IndexingException,
_abatch,
_get_document_with_hash,
)
from langchain_core.indexing.in_memory import InMemoryDocumentIndex
from langchain_core.vectorstores import InMemoryVectorStore, VectorStore
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
@pytest.fixture
def record_manager() -> InMemoryRecordManager:
"""Timestamped set fixture."""
record_manager = InMemoryRecordManager(namespace="hello")
record_manager.create_schema()
return record_manager
@pytest_asyncio.fixture
async def arecord_manager() -> InMemoryRecordManager:
"""Timestamped set fixture."""
record_manager = InMemoryRecordManager(namespace="hello")
await record_manager.acreate_schema()
return record_manager
@pytest.fixture
// ... (2883 more lines)
Domain
Subdomains
Functions
- _to_async_iter()
- arecord_manager()
- record_manager()
- test_abatch()
- test_adeduplication()
- test_afull_cleanup_with_different_batchsize()
- test_aincremental_cleanup_with_different_batchsize()
- test_aincremental_delete()
- test_aincremental_fails_with_bad_source_ids()
- test_aindex_delete_full_recovery_after_deletion_failure()
- test_aindex_empty_doc_scoped_full()
- test_aindex_into_document_index()
- test_aindex_simple_delete_full()
- test_aindex_simple_delete_scoped_full()
- test_aindex_with_upsert_kwargs()
- test_aindex_with_upsert_kwargs_for_document_indexer()
- test_aindexing_custom_batch_size()
- test_aindexing_force_update()
- test_aindexing_same_content()
- test_aindexing_with_no_docs()
- test_ano_delete()
- test_ascoped_full_fails_with_bad_source_ids()
- test_awithin_batch_deduplication_counting()
- test_deduplication()
- test_deduplication_v2()
- test_full_cleanup_with_different_batchsize()
- test_incremental_cleanup_with_different_batchsize()
- test_incremental_delete()
- test_incremental_delete_with_batch_size()
- test_incremental_delete_with_same_source()
- test_incremental_fails_with_bad_source_ids()
- test_incremental_indexing_with_batch_size()
- test_index_delete_full_recovery_after_deletion_failure()
- test_index_empty_doc_scoped_full()
- test_index_into_document_index()
- test_index_simple_delete_full()
- test_index_simple_delete_scoped_full()
- test_index_with_upsert_kwargs()
- test_index_with_upsert_kwargs_for_document_indexer()
- test_indexing_custom_batch_size()
- test_indexing_force_update()
- test_indexing_same_content()
- test_indexing_with_no_docs()
- test_no_delete()
- test_scoped_full_fails_with_bad_source_ids()
- test_within_batch_deduplication_counting()
- upserting_vector_store()
- vector_store()
Classes
Dependencies
- collections.abc
- datetime
- langchain_core.document_loaders.base
- langchain_core.documents
- langchain_core.embeddings
- langchain_core.indexing
- langchain_core.indexing.api
- langchain_core.indexing.in_memory
- langchain_core.vectorstores
- pytest
- pytest_asyncio
- pytest_mock
- typing
- 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, RunnableInterface subdomain.
What functions are defined in test_indexing.py?
test_indexing.py defines 48 function(s): _to_async_iter, arecord_manager, record_manager, test_abatch, test_adeduplication, test_afull_cleanup_with_different_batchsize, test_aincremental_cleanup_with_different_batchsize, test_aincremental_delete, test_aincremental_fails_with_bad_source_ids, test_aindex_delete_full_recovery_after_deletion_failure, and 38 more.
What does test_indexing.py depend on?
test_indexing.py imports 14 module(s): collections.abc, datetime, langchain_core.document_loaders.base, langchain_core.documents, langchain_core.embeddings, langchain_core.indexing, langchain_core.indexing.api, langchain_core.indexing.in_memory, and 6 more.
Where is test_indexing.py in the architecture?
test_indexing.py is located at libs/core/tests/unit_tests/indexing/test_indexing.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/unit_tests/indexing).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free