BubbleAI is a sophisticated AI-driven platform designed to ingest, process, and analyze documents, leveraging the power of OpenAI's embeddings and a robust FastAPI backend. It's built to handle a variety of tasks, including document ingestion, text extraction, and querying for insights using advanced natural language processing techniques. BubbleAI serves as the backend for AssistAI, a macOS application that utilizes its endpoints for RAG, ingestion and interference.
- Document Ingestion: Securely upload documents to be processed and analyzed.
- Text Extraction: Extract and process text from a variety of document formats.
- Vector Embedding: Utilize OpenAI's embeddings to convert text into vector representations for advanced analysis.
- Query System: Ask questions and receive insights based on the ingested and processed documents.
- Scalable Architecture: Deployed using Docker and AWS services for scalability and reliability.
- FastAPI
- Uvicorn (server)
- Gunicorn (process manager for Uvicorn)
- NGINX forwards 80 to 8000 (uvicorn)
- AWS CodeDeploy
- Docker and Docker Compose
- AWS CLI configured with access to S3, SQS, and ECR
- Python 3.11.3 or higher
- An OpenAI API key
- Clone the repository
git clone https://github.com/CocoaPriest/bubbleai.git
cd bubbleai
- Set up environment variables
Create a .env
file in the root directory and populate it with your AWS and OpenAI credentials:
OPENAI_API_KEY=your_openai_api_key
aws_access_key_id=your_aws_access_key_id
aws_secret_access_key=your_aws_secret_access_key
aws_region=your_aws_region
DATABASE_URL=your_database_url
- Install dependencies
pip install -r requirements.txt
- Build and run the Docker containers
docker-compose up --build
To ingest a document, send a POST request to /ingest
with the document file, its full path, and the machine ID.
curl -X 'POST' \
'http://localhost:8000/ingest' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@path/to/your/document.pdf;type=application/pdf' \
-F 'full_path=/documents/document.pdf' \
-F 'machine_id=your_machine_id'
To ask a question based on the ingested documents, send a POST request to /ask
with your question.
curl -X 'POST' \
'http://localhost:8000/ask' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"question": "What is the main topic of the ingested documents?"}'
The provided Makefile
includes commands for AWS login, Docker login, and deployment. Use these commands to deploy the application to an AWS EC2 instance.
make login
make docker_login
make docker_deploy
ssh -i ~/.ssh/fastapi_key.pem [email protected]
sudo vim /etc/nginx/sites-enabled/fastapi_nginx
docker pull 246532218018.dkr.ecr.eu-central-1.amazonaws.com/fastapi-bubble:latest
docker run -t -p 80:8000 246532218018.dkr.ecr.eu-central-1.amazonaws.com/fastapi-bubble:latest
source ~/.virtualenvs/bubble/bin/activate.fish
- Start docker:
make docker_up
2a. Now, I want to stop docker's web and start my local: a.docker stop web
b.make local_web
docker exec -it [name/id] /bin/bash
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
Distributed under the MIT License. See LICENSE
for more information.
This README is a brief overview of BubbleAI. For more detailed documentation, please refer to the individual files and code comments within the project.