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.
from gradient import Gradient
client = Gradient()
while True:
indexing_job = client.knowledge_bases.indexing_jobs.retrieve(
"uuid",
)
if indexing_job.job.phase in ["BATCH_JOB_PHASE_UNKNOWN", "BATCH_JOB_PHASE_PENDING", "BATCH_JOB_PHASE_RUNNING"]:
continue
This should of course handle failed states for errors and such