Table of Contents
This is the backend of Política Aberta, an open source project to help the Portuguese electors to choose their vote. It acts like a chatbot, where users can ask things to political parties and the answer is based on their political program.
Feel free to clone this repo, run it locally and contribute!
The following prerequisites are needed to run the project:
- Python
# Linux apt install python3 #OSX brew isntall python3
- [Optional] Docker
# Linux apt install docker #OSX brew install docker
- Clone the repo
git clone https://github.com/politica-aberta/backend.git && cd backend
- Create and activate virtual env
python -m venv political && source political/bin/activate
- Install Python packages
pip install -r < requirements - Create
.envfile in the root directory with OPENAI_API_KEY envtouch .env echo "OPENAI_API_KEY=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" > .env
To run the project locally, simply run it with flask cli:
flask runThis will run this api on port 5000
You can also run it with docker
docker compose up --build- Change infer_chat_mode to OpenAI function calling
- revisit system prompt
- Stream responses
- Add cache for requests
See the open issues for a full list of proposed features (and known issues).
Any contributions are greatly appreciated :)
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the corresponding tag.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Hugo Pitorro - xtwigs - pitorro@politica-aberta.pt
José Martinho - jmartinhoj - martinho@politica-aberta.pt
Project Link: https://github.com/politica-aberta/backend
