When a Gradient AI Platform Knowledge Base is indexed can run for several minutes. Currently users must write loops to poll for the job state, roughly.
import Gradient from '@digitalocean/gradient';
const client = new Gradient();
while (true) {
const job = await client.knowledgeBases.indexingJobs.retrieve('123e4567-e89b-12d3-a456-426614174000');
if (job.job.phase !== "BATCH_JOB_PHASE_RUNNING") {
continue;
}
}
This should of course handle failed states for errors and such