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
  c9b4a85b_e27f_cf5b_9483_77f56e8e71a5["embed_query()"]
  8c4a379d_0fe1_7eb6_796f_cb0827d0af6b["AngularTwoDimensionalEmbeddings"]
  c9b4a85b_e27f_cf5b_9483_77f56e8e71a5 -->|defined in| 8c4a379d_0fe1_7eb6_796f_cb0827d0af6b
  dce1cbf6_53f2_47fa_92e9_1221e0611d78["embed_documents()"]
  dce1cbf6_53f2_47fa_92e9_1221e0611d78 -->|calls| c9b4a85b_e27f_cf5b_9483_77f56e8e71a5
  4caf2596_8581_9dd2_f837_bc008110f9f5["embed_query()"]
  c9b4a85b_e27f_cf5b_9483_77f56e8e71a5 -->|calls| 4caf2596_8581_9dd2_f837_bc008110f9f5
  style c9b4a85b_e27f_cf5b_9483_77f56e8e71a5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/chroma/tests/integration_tests/fake_embeddings.py lines 69–81

    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

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free