Home / Function/ embed_query() — langchain Function Reference

embed_query() — langchain Function Reference

Architecture documentation for the embed_query() function in fake_embeddings.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  74c370b2_64fd_168e_a436_49577824b0b9["embed_query()"]
  c418c5f1_ecc0_49bb_d0c4_5905938825df["AngularTwoDimensionalEmbeddings"]
  74c370b2_64fd_168e_a436_49577824b0b9 -->|defined in| c418c5f1_ecc0_49bb_d0c4_5905938825df
  797a4722_3a38_4d43_be55_fd5fd0f8148c["embed_documents()"]
  797a4722_3a38_4d43_be55_fd5fd0f8148c -->|calls| 74c370b2_64fd_168e_a436_49577824b0b9
  424b48f2_1163_8b09_3d82_077893289663["embed_query()"]
  424b48f2_1163_8b09_3d82_077893289663 -->|calls| 74c370b2_64fd_168e_a436_49577824b0b9
  424b48f2_1163_8b09_3d82_077893289663["embed_query()"]
  74c370b2_64fd_168e_a436_49577824b0b9 -->|calls| 424b48f2_1163_8b09_3d82_077893289663
  style 74c370b2_64fd_168e_a436_49577824b0b9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py lines 79–91

    def embed_query(self, text: str) -> list[float]:
        """Convert input text to a 'vector' (list of floats).

        If the text is a number, use it as the angle for the
        unit vector in units of pi.
        Any other input text becomes the singular result [0, 0] !
        """
        try:
            angle = float(text)
            return [math.cos(angle * math.pi), math.sin(angle * math.pi)]
        except ValueError:
            # Assume: just test string, no attention is paid to values.
            return [0.0, 0.0]

Domain

Subdomains

Frequently Asked Questions

What does embed_query() do?
embed_query() is a function in the langchain codebase, defined in libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py.
Where is embed_query() defined?
embed_query() is defined in libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py at line 79.
What does embed_query() call?
embed_query() calls 1 function(s): embed_query.
What calls embed_query()?
embed_query() is called by 2 function(s): embed_documents, embed_query.

Analyze Your Own Codebase

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

Try Supermodel Free