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
  7040849b_fd0e_0aec_ed67_bb4fc8301333["test_infer_model_and_provider_errors()"]
  d83b56bb_a911_dd2e_ea6f_f5da87a02a7e["test_base.py"]
  7040849b_fd0e_0aec_ed67_bb4fc8301333 -->|defined in| d83b56bb_a911_dd2e_ea6f_f5da87a02a7e
  style 7040849b_fd0e_0aec_ed67_bb4fc8301333 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/embeddings/test_base.py lines 79–98

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 _SUPPORTED_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/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/tests/unit_tests/embeddings/test_base.py at line 79.

Analyze Your Own Codebase

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

Try Supermodel Free