Home / Function/ test_embed_query() — langchain Function Reference

test_embed_query() — langchain Function Reference

Architecture documentation for the test_embed_query() function in embeddings.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0032878c_f933_57ed_a972_e072a06525c5["test_embed_query()"]
  62dd6083_6171_c59e_a7f4_2ef6b850810c["EmbeddingsIntegrationTests"]
  0032878c_f933_57ed_a972_e072a06525c5 -->|defined in| 62dd6083_6171_c59e_a7f4_2ef6b850810c
  style 0032878c_f933_57ed_a972_e072a06525c5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/embeddings.py lines 39–58

    def test_embed_query(self, model: Embeddings) -> None:
        """Test embedding a string query.

        ??? note "Troubleshooting"

            If this test fails, check that:

            1. The model will generate a list of floats when calling `.embed_query`
                on a string.
            2. The length of the list is consistent across different inputs.
        """
        embedding_1 = model.embed_query("foo")

        assert isinstance(embedding_1, list)
        assert isinstance(embedding_1[0], float)

        embedding_2 = model.embed_query("bar")

        assert len(embedding_1) > 0
        assert len(embedding_1) == len(embedding_2)

Domain

Subdomains

Frequently Asked Questions

What does test_embed_query() do?
test_embed_query() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/embeddings.py.
Where is test_embed_query() defined?
test_embed_query() is defined in libs/standard-tests/langchain_tests/integration_tests/embeddings.py at line 39.

Analyze Your Own Codebase

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

Try Supermodel Free