AngularTwoDimensionalEmbeddings Class — langchain Architecture
Architecture documentation for the AngularTwoDimensionalEmbeddings class in fake_embeddings.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8c4a379d_0fe1_7eb6_796f_cb0827d0af6b["AngularTwoDimensionalEmbeddings"] b1e4f760_c634_d3bf_ca9a_db7ab899cc4a["Embeddings"] 8c4a379d_0fe1_7eb6_796f_cb0827d0af6b -->|extends| b1e4f760_c634_d3bf_ca9a_db7ab899cc4a 137cdc23_3587_d3e6_41a8_782c05eb74a4["fake_embeddings.py"] 8c4a379d_0fe1_7eb6_796f_cb0827d0af6b -->|defined in| 137cdc23_3587_d3e6_41a8_782c05eb74a4 dce1cbf6_53f2_47fa_92e9_1221e0611d78["embed_documents()"] 8c4a379d_0fe1_7eb6_796f_cb0827d0af6b -->|method| dce1cbf6_53f2_47fa_92e9_1221e0611d78 c9b4a85b_e27f_cf5b_9483_77f56e8e71a5["embed_query()"] 8c4a379d_0fe1_7eb6_796f_cb0827d0af6b -->|method| c9b4a85b_e27f_cf5b_9483_77f56e8e71a5
Relationship Graph
Source Code
libs/partners/chroma/tests/integration_tests/fake_embeddings.py lines 58–81
class AngularTwoDimensionalEmbeddings(Embeddings):
"""
From angles (as strings in units of pi) to unit embedding vectors on a circle.
"""
def embed_documents(self, texts: list[str]) -> list[list[float]]:
"""
Make a list of texts into a list of embedding vectors.
"""
return [self.embed_query(text) for text in texts]
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]
Extends
Source
Frequently Asked Questions
What is the AngularTwoDimensionalEmbeddings class?
AngularTwoDimensionalEmbeddings is a class in the langchain codebase, defined in libs/partners/chroma/tests/integration_tests/fake_embeddings.py.
Where is AngularTwoDimensionalEmbeddings defined?
AngularTwoDimensionalEmbeddings is defined in libs/partners/chroma/tests/integration_tests/fake_embeddings.py at line 58.
What does AngularTwoDimensionalEmbeddings extend?
AngularTwoDimensionalEmbeddings extends Embeddings.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free