Home / Function/ test_indexing_custom_batch_size() — langchain Function Reference

test_indexing_custom_batch_size() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/indexes/test_indexing.py lines 1481–1512

def test_indexing_custom_batch_size(
    record_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, "add_documents") as mock_add_documents:
        index(
            docs,
            record_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_indexing_custom_batch_size() do?
test_indexing_custom_batch_size() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/indexes/test_indexing.py.
Where is test_indexing_custom_batch_size() defined?
test_indexing_custom_batch_size() is defined in libs/langchain/tests/unit_tests/indexes/test_indexing.py at line 1481.

Analyze Your Own Codebase

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

Try Supermodel Free