Home / Function/ test_init_embedding_model() — langchain Function Reference

test_init_embedding_model() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  392bdebe_d04e_8a8e_0e68_83ec43ca84ef["test_init_embedding_model()"]
  791cc0c3_3784_5eb5_13b6_0f2e1529b8bd["test_base.py"]
  392bdebe_d04e_8a8e_0e68_83ec43ca84ef -->|defined in| 791cc0c3_3784_5eb5_13b6_0f2e1529b8bd
  style 392bdebe_d04e_8a8e_0e68_83ec43ca84ef fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/integration_tests/embeddings/test_base.py lines 20–44

async def test_init_embedding_model(provider: str, model: str) -> None:
    package = _BUILTIN_PROVIDERS[provider][0]
    try:
        importlib.import_module(package)
    except ImportError:
        pytest.skip(f"Package {package} is not installed")

    model_colon = init_embeddings(f"{provider}:{model}")
    assert isinstance(model_colon, Embeddings)

    model_explicit = init_embeddings(
        model=model,
        provider=provider,
    )
    assert isinstance(model_explicit, Embeddings)

    text = "Hello world"

    embedding_colon = await model_colon.aembed_query(text)
    assert isinstance(embedding_colon, list)
    assert all(isinstance(x, float) for x in embedding_colon)

    embedding_explicit = await model_explicit.aembed_query(text)
    assert isinstance(embedding_explicit, list)
    assert all(isinstance(x, float) for x in embedding_explicit)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free