Home / Function/ embed_documents() — langchain Function Reference

embed_documents() — langchain Function Reference

Architecture documentation for the embed_documents() function in fake_embeddings.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  83a52020_7802_533b_0bc5_92c500327050["embed_documents()"]
  d3609afb_32d8_29f5_39d7_a97fc460c871["ConsistentFakeEmbeddings"]
  83a52020_7802_533b_0bc5_92c500327050 -->|defined in| d3609afb_32d8_29f5_39d7_a97fc460c871
  424b48f2_1163_8b09_3d82_077893289663["embed_query()"]
  424b48f2_1163_8b09_3d82_077893289663 -->|calls| 83a52020_7802_533b_0bc5_92c500327050
  797a4722_3a38_4d43_be55_fd5fd0f8148c["embed_documents()"]
  83a52020_7802_533b_0bc5_92c500327050 -->|calls| 797a4722_3a38_4d43_be55_fd5fd0f8148c
  style 83a52020_7802_533b_0bc5_92c500327050 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py lines 50–60

    def embed_documents(self, texts: list[str]) -> list[list[float]]:
        """Return consistent embeddings for each text seen so far."""
        out_vectors = []
        for text in texts:
            if text not in self.known_texts:
                self.known_texts.append(text)
            vector = [1.0] * (self.dimensionality - 1) + [
                float(self.known_texts.index(text)),
            ]
            out_vectors.append(vector)
        return out_vectors

Domain

Subdomains

Called By

Frequently Asked Questions

What does embed_documents() do?
embed_documents() is a function in the langchain codebase, defined in libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py.
Where is embed_documents() defined?
embed_documents() is defined in libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py at line 50.
What does embed_documents() call?
embed_documents() calls 1 function(s): embed_documents.
What calls embed_documents()?
embed_documents() is called by 1 function(s): embed_query.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free