test_attention_embeddings() — langchain Function Reference
Architecture documentation for the test_attention_embeddings() function in test_fastembed_sparse.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3079d0a7_36fb_9206_9164_2b058ded880f["test_attention_embeddings()"] 8228bdd5_15cf_a5c9_d28a_d256613d02fc["test_fastembed_sparse.py"] 3079d0a7_36fb_9206_9164_2b058ded880f -->|defined in| 8228bdd5_15cf_a5c9_d28a_d256613d02fc style 3079d0a7_36fb_9206_9164_2b058ded880f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/qdrant/tests/integration_tests/fastembed/test_fastembed_sparse.py lines 12–37
def test_attention_embeddings(model_name: str) -> None:
model = FastEmbedSparse(model_name=model_name)
query_output = model.embed_query("Stay, steady and sprint.")
assert len(query_output.indices) == len(query_output.values)
assert np.allclose(query_output.values, np.ones(len(query_output.values)))
texts = [
"The journey of a thousand miles begins with a single step.",
"Be yourself in a world that is constantly trying to make you something else",
"In the end, we only regret the chances we didn't take.",
"Every moment is a fresh beginning.",
"Not all those who wander are lost.",
"Do not go where the path may lead, go elsewhere and leave a trail.",
"Life is what happens when you're busy making other plans.",
"The only limit to our realization of tomorrow is our doubts of today.",
]
output = model.embed_documents(texts)
assert len(output) == len(texts)
for result in output:
assert len(result.indices) == len(result.values)
assert len(result.indices) > 0
Domain
Subdomains
Source
Frequently Asked Questions
What does test_attention_embeddings() do?
test_attention_embeddings() is a function in the langchain codebase, defined in libs/partners/qdrant/tests/integration_tests/fastembed/test_fastembed_sparse.py.
Where is test_attention_embeddings() defined?
test_attention_embeddings() is defined in libs/partners/qdrant/tests/integration_tests/fastembed/test_fastembed_sparse.py at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free