AI development course #novice A2

Here is a prompt for that:

Build a simple chat that uses OpenAI API.

We use python and import the openai lib v. 1.6.*

We also want to store the chat in a database.

Let's use sqlite - and we only store one chat. No need to overcomplicate things.
A database table that stores datetime of the message, role (assistant/user), message, and a summary of that.

We want to send a user message, store that in the database as one data entry.

Then call the model and create a summary of the user message and add that to that entry.

Then create a chathistory

Then call the model with that and ask for a json that gives us a response and a summary of the response.

Then save the result into the database table
with role assistant.

For the following chat initialisations by the user we will use the last 4 messages of user and assistant in full and for the older messages we use the summaries to fill the chathistory.

I want a darkmode chat - modern design - one file python, one file html/javascript/css and a requirements.txt.

you can enhance the prompt using this technique

1 Like