Skip to main content

RAG API

This document outlines the API endpoints for managing Retrieval-Augmented Generation (RAG) components in PySpur.

Document Collections

Create Document Collection

Description: Creates a new document collection from uploaded files and metadata. The files are processed asynchronously in the background. URL: /rag/collections/ Method: POST Form Data:
Where metadata is a JSON string representing:
Response Schema:

List Document Collections

Description: Lists all document collections. URL: /rag/collections/ Method: GET Response Schema:

Get Document Collection

Description: Gets details of a specific document collection. URL: /rag/collections/{collection_id}/ Method: GET Parameters:
Response Schema:

Delete Document Collection

Description: Deletes a document collection and its associated data. URL: /rag/collections/{collection_id}/ Method: DELETE Parameters:
Response: 200 OK with message

Get Collection Progress

Description: Gets the processing progress of a document collection. URL: /rag/collections/{collection_id}/progress/ Method: GET Parameters:
Response Schema:

Add Documents to Collection

Description: Adds documents to an existing collection. The documents are processed asynchronously in the background. URL: /rag/collections/{collection_id}/documents/ Method: POST Parameters:
Form Data:
Response Schema:

Get Collection Documents

Description: Gets all documents and their chunks for a collection. URL: /rag/collections/{collection_id}/documents/ Method: GET Parameters:
Response Schema:
Where DocumentWithChunksSchema contains:

Delete Document from Collection

Description: Deletes a document from a collection. URL: /rag/collections/{collection_id}/documents/{document_id}/ Method: DELETE Parameters:
Response: 200 OK with message

Preview Chunk

Description: Previews how a document would be chunked with a given configuration. URL: /rag/collections/preview_chunk/ Method: POST Form Data:
Response Schema:

Vector Indices

Create Vector Index

Description: Creates a new vector index from a document collection. The index is created asynchronously in the background. URL: /rag/indices/ Method: POST Request Payload:
Response Schema:

List Vector Indices

Description: Lists all vector indices. URL: /rag/indices/ Method: GET Response Schema:

Get Vector Index

Description: Gets details of a specific vector index. URL: /rag/indices/{index_id}/ Method: GET Parameters:
Response Schema:

Delete Vector Index

Description: Deletes a vector index and its associated data. URL: /rag/indices/{index_id}/ Method: DELETE Parameters:
Response: 200 OK with message

Get Index Progress

Description: Gets the processing progress of a vector index. URL: /rag/indices/{index_id}/progress/ Method: GET Parameters:
Response Schema:

Retrieve from Index

Description: Retrieves relevant chunks from a vector index based on a query. URL: /rag/indices/{index_id}/retrieve/ Method: POST Parameters:
Request Payload:
Response Schema:
Where RetrievalResultSchema contains: