An open API service indexing awesome lists of open source software.

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.

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:
![img_1.png](img_1.png)

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