Q&A Planet is a AI platform where you can upload any document and ask question related to it
- ReactJs: For building the user interface.
- VueJs: For additional components and interactivity.
- FastAPI: For building the API efficiently.
- Python: The programming language used for the backend.
- Pydantic: For validating request and response data.
- CORS Middleware from FastAPI: To enable cross-origin resource sharing.
- PyMuPDF: For processing PDF files.
- LangChain: For text splitting and handling large documents.
- Hugging Face Transformers: For natural language processing tasks.
- Sentence Transformers: For embedding sentences and retrieving contextual information.
- SQLAlchemy ORM: For database interactions and object-relational mapping.
Use the package manager pip to install foobar. Copy the proejct url
cd ./frontend
npm install
and the frontend server will start
cd ./backend
To install all the dependencies
pip install fastapi uvicorn sqlalchemy pymupdf langchain transformers sentence-transformers fastapi[all]
To run the backend server
uvicorn main:app --reload
the server will run at port
http://127.0.0.1:8000/docs#/
- Endpoint:
/upload_pdf
- Method:
POST
- Description: Upload a PDF file to the server for processing.
-
Headers:
Content-Type
:multipart/form-data
-
Body:
file
: The PDF file to be uploaded (required).
- Status Code:
200 OK
- Response Body:
{ "document_id": "string" // The ID of the uploaded document. }
- Endpoint:
/ask_question
- Method:
POST
- Description: Submit a question related to the uploaded document and receive an answer.
-
Headers:
Content-Type
:application/json
-
Body:
document_id
: The ID of the document to ask questions about.question
: The question to be asked.
-
Status Code:
200 OK
-
Response Body:
{ "answer": "string" // The answer to the asked question. }
- Endpoint:
/document/{document_id}/questions
- Method:
GET
- Description: Retrieve a list of questions and answers associated with a specific document.
-
Path Parameters:
document_id
: The ID of the document for which questions are retrieved (required).
-
Status Code:
200 OK
-
Response Body:
[ { "question": "string", // The question asked. "answer": "string" // The answer provided. } ]