Home / Function/ get() — langchain Function Reference

get() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/chroma/langchain_chroma/vectorstores.py lines 1137–1176

    def get(
        self,
        ids: str | list[str] | None = None,
        where: Where | None = None,
        limit: int | None = None,
        offset: int | None = None,
        where_document: WhereDocument | None = None,
        include: list[str] | None = None,
    ) -> dict[str, Any]:
        """Gets the collection.

        Args:
            ids: The ids of the embeddings to get. Optional.
            where: A Where type dict used to filter results by.
                   E.g. `{"$and": [{"color": "red"}, {"price": 4.20}]}` Optional.
            limit: The number of documents to return. Optional.
            offset: The offset to start returning results from.
                    Useful for paging results with limit. Optional.
            where_document: A WhereDocument type dict used to filter by the documents.
                            E.g. `{"$contains": "hello"}`. Optional.
            include: A list of what to include in the results.
                     Can contain `"embeddings"`, `"metadatas"`, `"documents"`.
                     Ids are always included.
                     Defaults to `["metadatas", "documents"]`. Optional.

        Returns:
            A dict with the keys `"ids"`, `"embeddings"`, `"metadatas"`, `"documents"`.
        """
        kwargs = {
            "ids": ids,
            "where": where,
            "limit": limit,
            "offset": offset,
            "where_document": where_document,
        }

        if include is not None:
            kwargs["include"] = include

        return self._collection.get(**kwargs)  # type: ignore[arg-type, return-value]

Subdomains

Frequently Asked Questions

What does get() do?
get() is a function in the langchain codebase, defined in libs/partners/chroma/langchain_chroma/vectorstores.py.
Where is get() defined?
get() is defined in libs/partners/chroma/langchain_chroma/vectorstores.py at line 1137.
What calls get()?
get() is called by 2 function(s): _select_relevance_score_fn, get_by_ids.

Analyze Your Own Codebase

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

Try Supermodel Free