https://github.com/konstantinkalinichenko/insaithomeassignment
Simple Flask Server that exposes an endpoint to ask a question. The server sends the question to an OpenAI API, receives the answer, and saves both the question and the answer in a PostgreSQL database.
https://github.com/konstantinkalinichenko/insaithomeassignment
api flask-application openai postgresql postman pytest python-3 sqlalchemy
Last synced: 2 months ago
JSON representation
Simple Flask Server that exposes an endpoint to ask a question. The server sends the question to an OpenAI API, receives the answer, and saves both the question and the answer in a PostgreSQL database.
- Host: GitHub
- URL: https://github.com/konstantinkalinichenko/insaithomeassignment
- Owner: KonstantinKalinichenko
- Created: 2024-10-08T20:11:15.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-17T17:55:10.000Z (over 1 year ago)
- Last Synced: 2025-03-30T18:12:33.910Z (over 1 year ago)
- Topics: api, flask-application, openai, postgresql, postman, pytest, python-3, sqlalchemy
- Language: Python
- Homepage:
- Size: 146 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Home Assignment for Backend Internship
1. Install all the packages:
- Flask
- SQLAlchemy
- OpenAI
- dotenv
- pytest
- requests
- etc.
all the packages mentioned in **requirements.txt**
2. Create application (**flask_server.py**) with model with 3 columns (id, question, answer).
Create OpenAI integration according official documentation - https://github.com/openai/openai-python
Create migrations directory for alembic migrations.
3. Test application using pytest and requests library - **test_endpoint.py**
I've decided to test my application also by using Postman. Here's result:

3. Dockerize application and database according documentation - https://docs.docker.com/compose/