Home / Function/ test_aindexing_custom_batch_size() — langchain Function Reference

test_aindexing_custom_batch_size() — langchain Function Reference

Architecture documentation for the test_aindexing_custom_batch_size() function in test_indexing.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  72750a73_73f4_8569_4f90_bed02764382a["test_aindexing_custom_batch_size()"]
  9bc4e8b6_769a_ae11_3fc1_309cb678c248["test_indexing.py"]
  72750a73_73f4_8569_4f90_bed02764382a -->|defined in| 9bc4e8b6_769a_ae11_3fc1_309cb678c248
  style 72750a73_73f4_8569_4f90_bed02764382a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/indexes/test_indexing.py lines 1516–1547

async def test_aindexing_custom_batch_size(
    arecord_manager: SQLRecordManager,
    vector_store: InMemoryVectorStore,
) -> None:
    """Test indexing with a custom batch size."""
    docs = [
        Document(
            page_content="This is a test document.",
            metadata={"source": "1"},
        ),
    ]
    ids = [_get_document_with_hash(doc, key_encoder="sha256").id for doc in docs]

    batch_size = 1
    with patch.object(vector_store, "aadd_documents") as mock_add_documents:
        await aindex(
            docs,
            arecord_manager,
            vector_store,
            batch_size=batch_size,
            key_encoder="sha256",
        )
        args, kwargs = mock_add_documents.call_args
        docs_with_id = [
            Document(
                page_content="This is a test document.",
                metadata={"source": "1"},
                id=ids[0],
            ),
        ]
        assert args == (docs_with_id,)
        assert kwargs == {"ids": ids, "batch_size": batch_size}

Domain

Subdomains

Frequently Asked Questions

What does test_aindexing_custom_batch_size() do?
test_aindexing_custom_batch_size() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/indexes/test_indexing.py.
Where is test_aindexing_custom_batch_size() defined?
test_aindexing_custom_batch_size() is defined in libs/langchain/tests/unit_tests/indexes/test_indexing.py at line 1516.

Analyze Your Own Codebase

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

Try Supermodel Free