test_embed_documents() — langchain Function Reference
Architecture documentation for the test_embed_documents() function in embeddings.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6b4fd8bf_19d2_81ff_6cc1_c4ff185d8f23["test_embed_documents()"] 62dd6083_6171_c59e_a7f4_2ef6b850810c["EmbeddingsIntegrationTests"] 6b4fd8bf_19d2_81ff_6cc1_c4ff185d8f23 -->|defined in| 62dd6083_6171_c59e_a7f4_2ef6b850810c style 6b4fd8bf_19d2_81ff_6cc1_c4ff185d8f23 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/standard-tests/langchain_tests/integration_tests/embeddings.py lines 60–78
def test_embed_documents(self, model: Embeddings) -> None:
"""Test embedding a list of strings.
??? note "Troubleshooting"
If this test fails, check that:
1. The model will generate a list of lists of floats when calling
`embed_documents` on a list of strings.
2. The length of each list is the same.
"""
documents = ["foo", "bar", "baz"]
embeddings = model.embed_documents(documents)
assert len(embeddings) == len(documents)
assert all(isinstance(embedding, list) for embedding in embeddings)
assert all(isinstance(embedding[0], float) for embedding in embeddings)
assert len(embeddings[0]) > 0
assert all(len(embedding) == len(embeddings[0]) for embedding in embeddings)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_embed_documents() do?
test_embed_documents() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/embeddings.py.
Where is test_embed_documents() defined?
test_embed_documents() is defined in libs/standard-tests/langchain_tests/integration_tests/embeddings.py at line 60.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free