Chatbox fine tunning performance

From this example OpenAI API I can see that for the bot to understand how a conversation must evolve, you need to do incremental chats including previous responses.
I wonder if there’s a way to reference previous texts or do everything in one go, so It’s not as costly in terms of tokens.

Thanks in advance!

Most people use some kind of search function to add some context. Discord, for instance, gives you API-based search endpoints. You can also use Embeddings to search old messages.

Thanks, I was just watching your Theory of Mind video :slight_smile: !

I think my question wasn’t clear enough, or maybe I don’t get your answer.
What I mean is, from the example below, if there’s a way to only use the second line, or if we must do it incrementally like it’s shown. If it’s the second, I wanted to know if there is a third way of saving on tokens since a long conversation will have tons of repeated messages:

{"prompt":"Summary: <summary of the interaction so far>\n\nSpecific information:<for example order details in natural language>\n\n###\n\nCustomer: <message1>\nAgent: <response1>\nCustomer: <message2>\nAgent:", "completion":" <response2>\n"}
{"prompt":"Summary: <summary of the interaction so far>\n\nSpecific information:<for example order details in natural language>\n\n###\n\nCustomer: <message1>\nAgent: <response1>\nCustomer: <message2>\nAgent: <response2>\nCustomer: <message3>\nAgent:", "completion":" <response3>\n"}

Let me know if I can clarify any further! Thx!

That looks about right. You’ll have to experiment with it in terms of saving tokens. Here’s a rule of thumb that I was taught years ago for automation and ML:

Step 1: get it working perfectly
Step 2: optimize

Don’t worry about optimization just yet, unless you’ve already got it working well