LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdk_asyncstoreStoreClientsearch_items
    Method●Since v0.3

    search_items

    Copy
    search_items(
      self,
      namespace_prefix: Sequence[str],
      ,
      filter: Mapping[str
    View source on GitHub
    ,
    Any
    ]
    |
    None
    =
    None
    ,
    limit
    :
    int
    =
    10
    ,
    offset
    :
    int
    =
    0
    ,
    query
    :
    str
    |
    None
    =
    None
    ,
    refresh_ttl
    :
    bool
    |
    None
    =
    None
    ,
    headers
    :
    Mapping
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    params
    :
    QueryParamTypes
    |
    None
    =
    None
    )
    ->
    SearchItemsResponse

    Parameters

    NameTypeDescription
    namespace_prefix*Sequence[str]

    List of strings representing the namespace prefix.

    filterMapping[str, Any] | None
    Default:None

    Optional dictionary of key-value pairs to filter results.

    limitint
    Default:10
    offsetint
    Default:0
    querystr | None
    Default:None
    refresh_ttlbool | None
    Default:None
    headersMapping[str, str] | None
    Default:None
    paramsQueryParamTypes | None
    Default:None

    Search for items within a namespace prefix.

    client = get_client(url="http://localhost:2024")
    items = await client.store.search_items(
        ["documents"],
        filter={"author": "John Doe"},
        limit=5,
        offset=0
    )
    print(items)
    
    ----------------------------------------------------------------
    
    {
        "items": [
            {
                "namespace": ["documents", "user123"],
                "key": "item789",
                "value": {
                    "title": "Another Document",
                    "author": "John Doe"
                },
                "created_at": "2024-07-30T12:00:00Z",
                "updated_at": "2024-07-30T12:00:00Z"
            },
            # ... additional items ...
        ]
    }

    Maximum number of items to return (default is 10).

    Number of items to skip before returning results (default is 0).

    Optional query for natural language search.

    Whether to refresh the TTL on items returned by this search. If None, uses the store's default behavior.

    Optional custom headers to include with the request.

    Optional query parameters to include with the request.