Fetch a Paginated Conversation History and Compact It to a Token Budget
Asked at Sierra · Coding Questions · Difficulty: Medium · Last asked Nov 22, 2026
A chat assistant keeps each conversation on a server that hands it out one page at a time. Before the next model call, the assistant needs the whole conversation in order. It must then shrink that conversation so it fits the model's token budget, without losing the messages the model cannot work without. You write both steps: loading every page through the provided client, and cutting the result down to the budget.
Loading the problem…