Home / Function/ get_by_ids() — langchain Function Reference

get_by_ids() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c489f4b2_a552_196a_e9da_c556412defa7["get_by_ids()"]
  d25f9e94_3ec0_b9ca_7d2f_eb7ef487ccab["Chroma"]
  c489f4b2_a552_196a_e9da_c556412defa7 -->|defined in| d25f9e94_3ec0_b9ca_7d2f_eb7ef487ccab
  23cab88e_69e0_a0dd_e3ea_acdf63d743ac["get()"]
  c489f4b2_a552_196a_e9da_c556412defa7 -->|calls| 23cab88e_69e0_a0dd_e3ea_acdf63d743ac
  style c489f4b2_a552_196a_e9da_c556412defa7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/chroma/langchain_chroma/vectorstores.py lines 1178–1212

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

        The returned documents are expected to have the ID field set to the ID of the
        document in the vector store.

        Fewer documents may be returned than requested if some IDs are not found or
        if there are duplicated IDs.

        Users should not assume that the order of the returned documents matches
        the order of the input IDs. Instead, users should rely on the ID field of the
        returned documents.

        This method should **NOT** raise exceptions if no documents are found for
        some IDs.

        Args:
            ids: List of ids to retrieve.

        Returns:
            List of `Document` objects.

        !!! version-added "Added in 0.2.1"
        """
        results = self.get(ids=list(ids))
        return [
            Document(page_content=doc, metadata=meta, id=doc_id)
            for doc, meta, doc_id in zip(
                results["documents"],
                results["metadatas"],
                results["ids"],
                strict=False,
            )
            if doc is not None  # Filter out documents with None page_content
        ]

Subdomains

Calls

Frequently Asked Questions

What does get_by_ids() do?
get_by_ids() is a function in the langchain codebase, defined in libs/partners/chroma/langchain_chroma/vectorstores.py.
Where is get_by_ids() defined?
get_by_ids() is defined in libs/partners/chroma/langchain_chroma/vectorstores.py at line 1178.
What does get_by_ids() call?
get_by_ids() calls 1 function(s): get.

Analyze Your Own Codebase

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

Try Supermodel Free