Index a dataset for retrieval
Index a dataset for retrieval
datasets.index(strdataset_id, DatasetIndexParams**kwargs) -> RetrievalIndex
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.
Index a dataset for retrieval
import os
from adaption import Adaption
client = Adaption(
api_key=os.environ.get("ADAPTION_API_KEY"), # This is the default and can be omitted
)
retrieval_index = client.datasets.index(
dataset_id="dataset_id",
text_columns=["question", "answer"],
)
print(retrieval_index.dataset_id){
"dataset_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"status": "pending",
"error": "error"
}Returns Examples
{
"dataset_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"status": "pending",
"error": "error"
}