Home / Function/ test_infer_model_and_provider_errors() — langchain Function Reference

test_infer_model_and_provider_errors() — langchain Function Reference

Architecture documentation for the test_infer_model_and_provider_errors() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b377c4c4_1f1b_94d1_1fa7_333fed309a09["test_infer_model_and_provider_errors()"]
  da0101ff_3641_29c7_9da2_59715316b6f2["test_base.py"]
  b377c4c4_1f1b_94d1_1fa7_333fed309a09 -->|defined in| da0101ff_3641_29c7_9da2_59715316b6f2
  style b377c4c4_1f1b_94d1_1fa7_333fed309a09 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/embeddings/test_base.py lines 77–96

def test_infer_model_and_provider_errors() -> None:
    """Test error cases for model and provider inference."""
    # Test missing provider
    with pytest.raises(ValueError, match="Must specify either"):
        _infer_model_and_provider("text-embedding-3-small")

    # Test empty model
    with pytest.raises(ValueError, match="Model name cannot be empty"):
        _infer_model_and_provider("")

    # Test empty provider with model
    with pytest.raises(ValueError, match="Must specify either"):
        _infer_model_and_provider("model", provider="")

    # Test invalid provider
    with pytest.raises(ValueError, match="Provider 'invalid' is not supported") as exc:
        _infer_model_and_provider("model", provider="invalid")
    # Test provider list is in error
    for provider in _BUILTIN_PROVIDERS:
        assert provider in str(exc.value)

Domain

Subdomains

Frequently Asked Questions

What does test_infer_model_and_provider_errors() do?
test_infer_model_and_provider_errors() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/embeddings/test_base.py.
Where is test_infer_model_and_provider_errors() defined?
test_infer_model_and_provider_errors() is defined in libs/langchain_v1/tests/unit_tests/embeddings/test_base.py at line 77.

Analyze Your Own Codebase

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

Try Supermodel Free