Skip to content
SupportLogin
Index a dataset for retrieval

Index a dataset for retrieval

POST/api/v1/datasets/{dataset_id}/retrieval-index

Embeds the selected text columns of every row so the dataset can be searched. text_columns names the columns to search, in the order they are combined into each row’s text. Indexing runs in the background: poll GET /datasets/{dataset_id}/retrieval-index until status is succeeded, then pass the dataset id in file_search.dataset_ids on POST /responses. A dataset has one index. Repeating the request with the same text_columns returns the existing index instead of starting another, and different columns return 409. Once an index has failed, POST again, with the same or different text_columns, to rebuild it.

Path ParametersExpand Collapse
dataset_id: string
Body ParametersJSONExpand Collapse
text_columns: array of string

Columns whose text is searched, combined into each row’s text in this order. For most uploaded datasets these are the file’s column headers, even after adaptation. An unknown column returns 400 listing the columns that can be indexed.

ReturnsExpand Collapse
RetrievalIndex object { dataset_id, status, error }
dataset_id: string
formatuuid
status: "pending" or "running" or "succeeded" or "failed"

The dataset can be searched with file_search once this is succeeded.

One of the following:
"pending"
"running"
"succeeded"
"failed"
error: optional string

Why indexing failed. Present only when status is failed.

Index a dataset for retrieval

curl https://api.prod.adaptionlabs.ai/api/v1/datasets/$DATASET_ID/retrieval-index \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ADAPTION_API_KEY" \
    -d '{
          "text_columns": [
            "question",
            "answer"
          ]
        }'
{
  "dataset_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "status": "pending",
  "error": "error"
}
Returns Examples
{
  "dataset_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "status": "pending",
  "error": "error"
}