AngularTwoDimensionalEmbeddings Class — langchain Architecture
Architecture documentation for the AngularTwoDimensionalEmbeddings class in fake_embeddings.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD c418c5f1_ecc0_49bb_d0c4_5905938825df["AngularTwoDimensionalEmbeddings"] b1e4f760_c634_d3bf_ca9a_db7ab899cc4a["Embeddings"] c418c5f1_ecc0_49bb_d0c4_5905938825df -->|extends| b1e4f760_c634_d3bf_ca9a_db7ab899cc4a b656da5c_781f_2669_c8cd_83d309b3feb8["fake_embeddings.py"] c418c5f1_ecc0_49bb_d0c4_5905938825df -->|defined in| b656da5c_781f_2669_c8cd_83d309b3feb8 797a4722_3a38_4d43_be55_fd5fd0f8148c["embed_documents()"] c418c5f1_ecc0_49bb_d0c4_5905938825df -->|method| 797a4722_3a38_4d43_be55_fd5fd0f8148c 74c370b2_64fd_168e_a436_49577824b0b9["embed_query()"] c418c5f1_ecc0_49bb_d0c4_5905938825df -->|method| 74c370b2_64fd_168e_a436_49577824b0b9
Relationship Graph
Source Code
libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py lines 71–91
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]
@override
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/langchain_v1/tests/integration_tests/cache/fake_embeddings.py.
Where is AngularTwoDimensionalEmbeddings defined?
AngularTwoDimensionalEmbeddings is defined in libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py at line 71.
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