Home / Function/ test_initialization_with_from_model_id() — langchain Function Reference

test_initialization_with_from_model_id() — langchain Function Reference

Architecture documentation for the test_initialization_with_from_model_id() function in test_huggingface_pipeline.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5b7b17de_d0e0_c1e6_d483_46b9d17a4e95["test_initialization_with_from_model_id()"]
  f31955a1_0524_be5f_87e5_aca998c86526["test_huggingface_pipeline.py"]
  5b7b17de_d0e0_c1e6_d483_46b9d17a4e95 -->|defined in| f31955a1_0524_be5f_87e5_aca998c86526
  style 5b7b17de_d0e0_c1e6_d483_46b9d17a4e95 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/huggingface/tests/unit_tests/test_huggingface_pipeline.py lines 30–47

def test_initialization_with_from_model_id(
    mock_pipeline: MagicMock, mock_model: MagicMock, mock_tokenizer: MagicMock
) -> None:
    """Test initialization with the from_model_id method."""
    mock_tokenizer.return_value = MagicMock(pad_token_id=0)
    mock_model.return_value = MagicMock()

    mock_pipe = MagicMock()
    mock_pipe.task = "text-generation"
    mock_pipe.model = mock_model.return_value
    mock_pipeline.return_value = mock_pipe

    llm = HuggingFacePipeline.from_model_id(
        model_id="mock-model-id",
        task="text-generation",
    )

    assert llm.model_id == "mock-model-id"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free