Home / Function/ embed_documents() — langchain Function Reference

embed_documents() — langchain Function Reference

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

Function python LangChainCore Runnables calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  b9e09bee_ce68_fd2b_005f_81e22de97c53["embed_documents()"]
  e01269d9_4bda_3502_ba27_5bad4874d109["ConsistentFakeSparseEmbeddings"]
  b9e09bee_ce68_fd2b_005f_81e22de97c53 -->|defined in| e01269d9_4bda_3502_ba27_5bad4874d109
  c7906a5b_be59_8e0f_0985_35c80ce0e933["embed_documents()"]
  c7906a5b_be59_8e0f_0985_35c80ce0e933 -->|calls| b9e09bee_ce68_fd2b_005f_81e22de97c53
  5369e966_8af1_33ce_87ff_9b00c71877a5["embed_query()"]
  5369e966_8af1_33ce_87ff_9b00c71877a5 -->|calls| b9e09bee_ce68_fd2b_005f_81e22de97c53
  c7906a5b_be59_8e0f_0985_35c80ce0e933["embed_documents()"]
  b9e09bee_ce68_fd2b_005f_81e22de97c53 -->|calls| c7906a5b_be59_8e0f_0985_35c80ce0e933
  style b9e09bee_ce68_fd2b_005f_81e22de97c53 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/tests/integration_tests/common.py lines 70–80

    def embed_documents(self, texts: list[str]) -> list[SparseVector]:
        """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)
            index = self.known_texts.index(text)
            indices = [i + index for i in range(self.dimensionality)]
            values = [1.0] * (self.dimensionality - 1) + [float(index)]
            out_vectors.append(SparseVector(indices=indices, values=values))
        return out_vectors

Domain

Subdomains

Frequently Asked Questions

What does embed_documents() do?
embed_documents() is a function in the langchain codebase, defined in libs/partners/qdrant/tests/integration_tests/common.py.
Where is embed_documents() defined?
embed_documents() is defined in libs/partners/qdrant/tests/integration_tests/common.py at line 70.
What does embed_documents() call?
embed_documents() calls 1 function(s): embed_documents.
What calls embed_documents()?
embed_documents() is called by 2 function(s): embed_documents, embed_query.

Analyze Your Own Codebase

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

Try Supermodel Free