How to use the open ai api in a specific conversation like in the website

how to use the open ai api in a specific conversation like in the website i mean in python or how to link the api in the program to a specific conversation so that it would remember things i am new to this so pls tell me with an example

Welcome to the forum. You simply need to append the previous messages to the prompt you’re sending.

2 Likes

you need memory. please take a look here langchain_examples/examples/load_qa_example01.py at main · rajib76/langchain_examples · GitHub

1 Like

You need the “standalone question”.

Here is how I learned it: Chat Completion Architechture

Here’s how I use it: How to construct the prompt for a standalone question?

You should also make sure that the people on your website don’t try to get into NSFW chats with your bot. That might lead to termination of your account.

I would suggest to use PHP instead of python:

is it possible to connect php openai chatgpt client to a specific session. or is it possible using python itself. also you can tell how to do it.