How do I schedule automatic reindexing for my knowledge bases?

Validated on 13 Feb 2025 • Last edited on 17 Apr 2025

Regular reindexing ensures your knowledge base reflects the most current data, improving the accuracy and relevance of responses. Set up a scheduled function with the reindex.py function below to trigger knowledge base reindexing using the StartIndexingJob API.

reindex.py
from pydo import Client
import os

c = Client(os.getenv("DO_API_KEY"))
c.genai.create_indexing_job(body={
  "knowledge_base_uuid": "KB UUID",
  "data_source_uuids": ["DS UUID"]  # optional, reindexes all data sources if not specified
})

We can't find any results for your search.

Try using different keywords or simplifying your search terms.