Context in seperate messages, or all in user prompt

I’ve finetuned a model which you can chat with, and which can carry out other, more complex tasks using function calling.

I’m having a bit of difficulty with context management.

For the chat feature, I’ve found it works best to pass all previous message exchanges in as message objects, e.g:

“messages”:[
{user message 1}
{assistant response 1}
{user message 2}
{assistant response 2}
{Current user message}
]

But for the function calling feature of the model, the function arguments are quite long. So when I’ve tried passing all of the previous user-assistant exchanges into the messages, although the responses have been good, I’ve racked up a hefty bill!!

In cases like this, is the best approach to summarize previous user-assistant interactions and pass them into the current message? E.g:

{“role”:“user”,“content”:“Current user request. Previous messages: [summaries of previous assistant interactions]”}