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.
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
})