v5

latestOpenAPI 3.1.02026-08-04166362486.5 KB
stores

List store chunks by metadata filter and numeric ranking

List store chunks purely by metadata filters — no embeddings, no semantic similarity, no reranking.

Unlike /stores/search, this endpoint does not require a query and never runs a vector lookup. It returns chunks whose file and chunk metadata satisfy filters, optionally ordered by a numeric metadata field via sort_by. Useful for ranked retrieval over numeric attributes (e.g. price, BPM) and for reproducing the agentic filter_chunks tool externally.

list-chunks targets a single store and does not support pagination; raise top_k to retrieve more chunks.

Args: filter_params: Filter configuration including: - store_identifiers: the single store to filter against - filters: optional metadata filter conditions - file_ids: optional list of file IDs to filter chunks by - sort_by: optional metadata field path, or (field, ascending) tuple, for numeric ordering - top_k: number of chunks to return

Returns: StoreListChunksResponse containing the list of matching chunks.

Raises: HTTPException (400): If filter parameters are invalid or multiple stores are passed HTTPException (404): If the store is not found

post/v1/stores/list-chunks

Request body

top_kinteger

Number of results to return

file_idsstring[] nullable

Optional list of file IDs to filter chunks by (inclusion filter)

sort_bystring nullable

Optional sort applied to the returned chunks. Pass a metadata field path or a tuple of (field path, ascending). Unprefixed dot paths target file metadata; generated_metadata.* targets chunk metadata.

Example request

{
  "filters": {
    "all": [
      {
        "key": "price",
        "operator": "gt",
        "value": "100"
      },
      {
        "key": "color",
        "operator": "eq",
        "value": "red"
      }
    ],
    "any": [
      {
        "key": "price",
        "operator": "gt",
        "value": "100"
      },
      {
        "key": "color",
        "operator": "eq",
        "value": "red"
      }
    ],
    "none": [
      {
        "key": "price",
        "operator": "gt",
        "value": "100"
      },
      {
        "key": "color",
        "operator": "eq",
        "value": "red"
      }
    ]
  },
  "file_ids": [
    "123e4567-e89b-12d3-a456-426614174000",
    "123e4567-e89b-12d3-a456-426614174001"
  ],
  "sort_by": "price",
  "search_options": {
    "rerank": {
      "model": "rerank_model",
      "top_k": 10
    }
  }
}

Response

List of chunks matching the metadata filters, optionally ordered by a numeric metadata field

object'list'

The object type of the response

Example response

{
  "data": [
    {
      "mime_type": "text/plain",
      "model": "text-embedding-ada-002",
      "score": 0.5,
      "file_id": "file1",
      "filename": "file1",
      "store_id": "store1",
      "external_id": "ext-123",
      "metadata": {
        "key": "value"
      },
      "context": "This chunk is from an SEC filing on ACME corp's Q2 2023 performance.",
      "summary": "A short overview of ACME's Q2 2023 performance."
    }
  ]
}