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 76f25d73_04c2_6b9d_ccc7_c1b1d6d106d8["embed_query()"] bbd47f76_d825_e868_c481_441b9a41a376["AngularTwoDimensionalEmbeddings"] 76f25d73_04c2_6b9d_ccc7_c1b1d6d106d8 -->|defined in| bbd47f76_d825_e868_c481_441b9a41a376 119760c2_93a9_f08e_4423_1af7744c75bd["embed_documents()"] 119760c2_93a9_f08e_4423_1af7744c75bd -->|calls| 76f25d73_04c2_6b9d_ccc7_c1b1d6d106d8 f91f62e2_f3f4_c3b1_fa56_7ac7544ca8e1["embed_query()"] 76f25d73_04c2_6b9d_ccc7_c1b1d6d106d8 -->|calls| f91f62e2_f3f4_c3b1_fa56_7ac7544ca8e1 style 76f25d73_04c2_6b9d_ccc7_c1b1d6d106d8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/integration_tests/cache/fake_embeddings.py lines 98–117
def embed_query(self, text: str) -> list[float]:
"""Embed query text.
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] !
Args:
text: Text to embed.
Returns:
Embedding.
"""
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
Calls
Called By
Source
Frequently Asked Questions
What does embed_query() do?
embed_query() is a function in the langchain codebase, defined in libs/langchain/tests/integration_tests/cache/fake_embeddings.py.
Where is embed_query() defined?
embed_query() is defined in libs/langchain/tests/integration_tests/cache/fake_embeddings.py at line 98.
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