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
  9a2d75e5_fa29_2cae_6338_23cc8603e2c1["test_aindexing_custom_batch_size()"]
  a9fb4c74_0865_0941_ade3_563a79762cee["test_indexing.py"]
  9a2d75e5_fa29_2cae_6338_23cc8603e2c1 -->|defined in| a9fb4c74_0865_0941_ade3_563a79762cee
  style 9a2d75e5_fa29_2cae_6338_23cc8603e2c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/indexing/test_indexing.py lines 2593–2620

async def test_aindexing_custom_batch_size(
    arecord_manager: InMemoryRecordManager, 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
    mock_add_documents = AsyncMock()
    doc_with_id = Document(
        id=ids[0], page_content="This is a test document.", metadata={"source": "1"}
    )
    vector_store.aadd_documents = mock_add_documents  # type: ignore[method-assign]
    await aindex(
        docs,
        arecord_manager,
        vector_store,
        batch_size=batch_size,
        key_encoder="sha256",
    )
    args, kwargs = mock_add_documents.call_args
    assert args == ([doc_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/core/tests/unit_tests/indexing/test_indexing.py.
Where is test_aindexing_custom_batch_size() defined?
test_aindexing_custom_batch_size() is defined in libs/core/tests/unit_tests/indexing/test_indexing.py at line 2593.

Analyze Your Own Codebase

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

Try Supermodel Free