Spaces:
Running
Running
Document RAG User API
This is a FastAPI application for processing and managing document uploads, including PDF and text files. The application allows users to upload files, query collections, and manage their document data.
Features
- Upload files in various formats (PDF, TXT, etc.)
- Efficiently process and store document chunks with metadata
- Perform queries on collections using user-defined input
- Retrieve and list collections specific to each user
- Remove collections as needed
Requirements
- Python 3.7+
- FastAPI
- LanceDB
- Pydantic
- Pandas
- Other dependencies as specified in
requirements.txt
Installation
Clone the repository:
git clone <repository-url> cd <repository-directory>
Install the required packages:
pip install -r requirements.txt
Run the application:
uvicorn app.document_rag_user:app --reload
API Endpoints
Upload Files
- POST
/upload_files
- Upload multiple files.
- Parameters:
files
: List of files to upload.collection_name
: Optional name for the collection.user_id
: User identifier.
Get Document
- GET
/get_document/{collection_id}/{document_id}
- Retrieve a specific document by its ID from a collection.
- Parameters:
collection_id
: ID of the collection.document_id
: ID of the document.user_id
: User identifier.
Query Collection
- POST
/query_collection
- Query a collection based on user input.
- Request Body:
collection_id
: ID of the collection.query
: Search query.top_k
: Optional number of top results to return (default is 3).user_id
: User identifier.
List Collections
- GET
/list_collections
- List all collections for a specific user.
- Parameters:
user_id
: User identifier.
Delete Collection
- DELETE
/delete_collection/{collection_id}
- Delete a specific collection.
- Parameters:
collection_id
: ID of the collection to delete.user_id
: User identifier.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
License
This project is licensed under the MIT License - see the LICENSE file for details.