Home / Function/ embed_documents() — langchain Function Reference

embed_documents() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  612e991b_9f93_9ffa_30df_6f17578ea52c["embed_documents()"]
  1edabc9d_e73c_8bf1_13cc_acd640cb321f["MockEmbeddings"]
  612e991b_9f93_9ffa_30df_6f17578ea52c -->|defined in| 1edabc9d_e73c_8bf1_13cc_acd640cb321f
  542e1801_430c_7d6c_1509_5625ebfe2fd8["test_embed_documents()"]
  542e1801_430c_7d6c_1509_5625ebfe2fd8 -->|calls| 612e991b_9f93_9ffa_30df_6f17578ea52c
  ff69f32b_472e_9872_ff62_67f040754ef8["test_embed_documents_batch()"]
  ff69f32b_472e_9872_ff62_67f040754ef8 -->|calls| 612e991b_9f93_9ffa_30df_6f17578ea52c
  7a51ab83_8cff_1ddb_7a4b_1a56eaf2f8fa["test_blake2b_encoder()"]
  7a51ab83_8cff_1ddb_7a4b_1a56eaf2f8fa -->|calls| 612e991b_9f93_9ffa_30df_6f17578ea52c
  ac739b9d_ae55_f1db_6fe8_be4fc05c1cdc["test_sha256_encoder()"]
  ac739b9d_ae55_f1db_6fe8_be4fc05c1cdc -->|calls| 612e991b_9f93_9ffa_30df_6f17578ea52c
  7a7e7aad_ebb5_8fed_4675_773d3bd20cc3["test_sha512_encoder()"]
  7a7e7aad_ebb5_8fed_4675_773d3bd20cc3 -->|calls| 612e991b_9f93_9ffa_30df_6f17578ea52c
  5274b871_faca_3fcc_a18d_f93b25bf4421["test_custom_encoder()"]
  5274b871_faca_3fcc_a18d_f93b25bf4421 -->|calls| 612e991b_9f93_9ffa_30df_6f17578ea52c
  style 612e991b_9f93_9ffa_30df_6f17578ea52c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/embeddings/test_caching.py lines 18–26

    def embed_documents(self, texts: list[str]) -> list[list[float]]:
        # Simulate embedding documents
        embeddings: list[list[float]] = []
        for text in texts:
            if text == "RAISE_EXCEPTION":
                msg = "Simulated embedding failure"
                raise ValueError(msg)
            embeddings.append([len(text), len(text) + 1])
        return embeddings

Domain

Subdomains

Frequently Asked Questions

What does embed_documents() do?
embed_documents() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/embeddings/test_caching.py.
Where is embed_documents() defined?
embed_documents() is defined in libs/langchain/tests/unit_tests/embeddings/test_caching.py at line 18.
What calls embed_documents()?
embed_documents() is called by 6 function(s): test_blake2b_encoder, test_custom_encoder, test_embed_documents, test_embed_documents_batch, test_sha256_encoder, test_sha512_encoder.

Analyze Your Own Codebase

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

Try Supermodel Free