This guide provides instructions for setting up the RAG API project and its associated services.
Ensure you have the following installed:
- Python 3.x
- pip (Python package installer)
- Git
First, clone the project repository:
git clone https://github.com/iCog-Labs-Dev/RAG-API.git
cd RAG-API
Create a virtual environment to manage project dependencies:
# On Unix or MacOS
python3 -m venv venv
source venv/bin/activate
# On Windows
python -m venv venv
venv\Scripts\activate
Install the required dependencies:
pip install -r requirements.txt
Create a .env file in the project root directory (where manage.py is located) and set your environment variables. For example:
API_KEY=your-api-key
Make sure to replace the placeholders with your actual values.
Apply database migrations:
python manage.py migrate
Start the development server:
The server will start at http://127.0.0.1:8000/.
To upload a .txt file to the server, you can use the /upload/ endpoint. Example using curl:
curl -X POST -F "file=@/path/to/your/file.txt" http://127.0.0.1:8000/upload/
Replace /path/to/your/file.txt with the path to your file.
To query the API with a text query and a method (either global or local), use the /query/ endpoint. Example using curl:
curl -X POST -d "text_query=your query&method_option=global" http://127.0.0.1:8000/query/
Replace your query with your actual query and global with the method option (global or local).