INNER CODE UNIT · Python
load_index
kaito-project/kaito · presets/ragengine/main.py:771
async def load_index(
index_name: str,
path: str | None = Query(None, description="Path to load the index from"),
overwrite: bool = Query(
False, description="Overwrite the existing index if it already exists"
),
):
# If no path is provided, use the default directory joined with index_name.
if path is None:
path = os.path.join(DEFAULT_VECTOR_DB_PERSIST_DIR, index_name)
start_time = time.perf_counter()
status = STATUS_FAILURE # Default status
try:
path = resolve_storage_path(path)
await rag_ops.load(index_name, path, overwrite)
status = STATUS_SUCCESS