Home / Function/ test_azure_openai_embedding_with_empty_string() — langchain Function Reference

test_azure_openai_embedding_with_empty_string() — langchain Function Reference

Architecture documentation for the test_azure_openai_embedding_with_empty_string() function in test_azure.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  df3a3585_56f8_a39f_c242_4c844580bfc9["test_azure_openai_embedding_with_empty_string()"]
  b6441089_df7b_2f5f_20e3_97ad397ec4f9["test_azure.py"]
  df3a3585_56f8_a39f_c242_4c844580bfc9 -->|defined in| b6441089_df7b_2f5f_20e3_97ad397ec4f9
  e0a47da9_250f_6bd7_3263_1ac362d554a6["_get_embeddings()"]
  df3a3585_56f8_a39f_c242_4c844580bfc9 -->|calls| e0a47da9_250f_6bd7_3263_1ac362d554a6
  style df3a3585_56f8_a39f_c242_4c844580bfc9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/embeddings/test_azure.py lines 101–121

def test_azure_openai_embedding_with_empty_string() -> None:
    """Test openai embeddings with empty string."""

    document = ["", "abc"]
    embedding = _get_embeddings()
    output = embedding.embed_documents(document)
    assert len(output) == 2
    assert len(output[0]) == 1536
    expected_output = (
        openai.AzureOpenAI(
            api_version=OPENAI_API_VERSION,
            api_key=OPENAI_API_KEY,
            azure_endpoint=OPENAI_API_BASE,
            azure_deployment=DEPLOYMENT_NAME,
        )  # type: ignore
        .embeddings.create(input="", model="text-embedding-ada-002")
        .data[0]
        .embedding
    )
    assert np.allclose(output[0], expected_output, atol=0.001)
    assert len(output[1]) == 1536

Domain

Subdomains

Frequently Asked Questions

What does test_azure_openai_embedding_with_empty_string() do?
test_azure_openai_embedding_with_empty_string() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/embeddings/test_azure.py.
Where is test_azure_openai_embedding_with_empty_string() defined?
test_azure_openai_embedding_with_empty_string() is defined in libs/partners/openai/tests/integration_tests/embeddings/test_azure.py at line 101.
What does test_azure_openai_embedding_with_empty_string() call?
test_azure_openai_embedding_with_empty_string() calls 1 function(s): _get_embeddings.

Analyze Your Own Codebase

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

Try Supermodel Free