Home / Function/ get_by_ids() — langchain Function Reference

get_by_ids() — langchain Function Reference

Architecture documentation for the get_by_ids() function in in_memory.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fc89eafe_4c79_e4f9_2899_ccb68fb46a09["get_by_ids()"]
  6e491709_d60f_689d_8a1a_c760b54fd120["InMemoryVectorStore"]
  fc89eafe_4c79_e4f9_2899_ccb68fb46a09 -->|defined in| 6e491709_d60f_689d_8a1a_c760b54fd120
  26207b71_7bb5_1c7e_c62d_3123be345b5c["aget_by_ids()"]
  26207b71_7bb5_1c7e_c62d_3123be345b5c -->|calls| fc89eafe_4c79_e4f9_2899_ccb68fb46a09
  style fc89eafe_4c79_e4f9_2899_ccb68fb46a09 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/vectorstores/in_memory.py lines 256–277

    def get_by_ids(self, ids: Sequence[str], /) -> list[Document]:
        """Get documents by their ids.

        Args:
            ids: The IDs of the documents to get.

        Returns:
            A list of `Document` objects.
        """
        documents = []

        for doc_id in ids:
            doc = self.store.get(doc_id)
            if doc:
                documents.append(
                    Document(
                        id=doc["id"],
                        page_content=doc["text"],
                        metadata=doc["metadata"],
                    )
                )
        return documents

Subdomains

Called By

Frequently Asked Questions

What does get_by_ids() do?
get_by_ids() is a function in the langchain codebase, defined in libs/core/langchain_core/vectorstores/in_memory.py.
Where is get_by_ids() defined?
get_by_ids() is defined in libs/core/langchain_core/vectorstores/in_memory.py at line 256.
What calls get_by_ids()?
get_by_ids() is called by 1 function(s): aget_by_ids.

Analyze Your Own Codebase

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

Try Supermodel Free