How to keep session with OpenAI API?

Hey there,

what is the best way to work with previously outputs from GPT?

I saw that OpenAI API is stateless and I have to send previously inputs + outputs + new inputs to reference to an old answer.

What is the best approach to save tokens?

I saw summarizing of keypoints could work but it is not exactly enough for fine tuning.

What are your best ways?

Hi and welcome to the Forum!

What specifically are you looking to achieve / create?

How does fine-tuning come into play here?

you could look at the “assistant” function, it’s well setup for that kind of work. you first create a thread and run, then you can add messages to this sames “thread_id” until the session end on your side, but according to the documentation a thread expire 60 days from it’s creation.

1 Like

Like @Dave.girard mentioned, use OpenAI Assistant. Here’s an introductory video on OpenAI Assistant V2.

1 Like

See here (https://youtu.be/6JeR-w_NJ84) for a mechanism to send back selective messages; so that you can hone the agent on the specific inputs.