Home / Function/ test_embed_documents_passes_options() — langchain Function Reference

test_embed_documents_passes_options() — langchain Function Reference

Architecture documentation for the test_embed_documents_passes_options() function in test_embeddings.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  52b9ab17_e86b_e18d_d0c3_5c9f56cc7013["test_embed_documents_passes_options()"]
  19edcbbb_8204_9855_a4b7_99dca4b148ba["test_embeddings.py"]
  52b9ab17_e86b_e18d_d0c3_5c9f56cc7013 -->|defined in| 19edcbbb_8204_9855_a4b7_99dca4b148ba
  style 52b9ab17_e86b_e18d_d0c3_5c9f56cc7013 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/unit_tests/test_embeddings.py lines 30–52

def test_embed_documents_passes_options(mock_client_class: Any) -> None:
    """Test that `embed_documents()` passes options, including `num_gpu`."""
    mock_client = Mock()
    mock_client_class.return_value = mock_client
    mock_client.embed.return_value = {"embeddings": [[0.1, 0.2, 0.3]]}

    embeddings = OllamaEmbeddings(model=MODEL_NAME, num_gpu=4, temperature=0.5)
    result = embeddings.embed_documents(["test text"])

    assert result == [[0.1, 0.2, 0.3]]

    # Check that embed was called with correct arguments
    mock_client.embed.assert_called_once()
    call_args = mock_client.embed.call_args

    # Verify the keyword arguments
    assert "options" in call_args.kwargs
    assert "keep_alive" in call_args.kwargs

    # Verify options contain num_gpu and temperature
    options = call_args.kwargs["options"]
    assert options["num_gpu"] == 4
    assert options["temperature"] == 0.5

Domain

Subdomains

Frequently Asked Questions

What does test_embed_documents_passes_options() do?
test_embed_documents_passes_options() is a function in the langchain codebase, defined in libs/partners/ollama/tests/unit_tests/test_embeddings.py.
Where is test_embed_documents_passes_options() defined?
test_embed_documents_passes_options() is defined in libs/partners/ollama/tests/unit_tests/test_embeddings.py at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free