This is a FastAPI application that utilizes Langchain to answer questions based on documents stored in the "app/experiences" folder. Each document is stored as a .py file containing JSON strings to be processed by Langchain.
There's a full cycle of CI/CD implemented with Github Actions.
The project structure is organized as follows:
-
.github/workflows: The CI/CD implementation -
app/: The main application folder.experiences/: Contains documents in.pyfiles as JSON strings to be processed.main.py: The entry point for the FastAPI application.qa_bot.py: Contains the code for answering questions using Langchain.
-
tests/: Contains JSON files used for running tests against the API.
To run the FastAPI application locally, follow these steps inside the repository root:
-
Create a virtual environment using
virtualenv:virtualenv venv
-
Activate the virtual environment:
source venv/bin/activate -
Install the required dependencies using
pip:pip install -r requirements.txt
-
Start the FastAPI application using
uvicorn:uvicorn app.main:app --reload
The API will be available at http://localhost:8000.
To get answers to questions, make a POST request to http://localhost:8000/get_answer with a JSON payload containing the "question" attribute. The API will respond with answers based on the provided question and documents in the "app/experiences" folder.
This project utilizes Pydantic to validate API calls, ensuring that the data sent to the API is in the expected format.
You can run tests against the API using the JSON files in the tests folder. These test files contain sample input data for various questions to verify the functionality of your Q&A bot.
Please read the CONTRIBUTING.md for instructions