Every chat product hits this on day two. The conversation grows, the window does not, and something has to go. Drop the wrong thing and the assistant forgets its instructions or the API rejects the request outright.
Write fit_history(messages, max_tokens).
messages is a list of {"role": ..., "text": ...} in chronological order, where role is "system", "user" or "assistant". A message costs len(text.split()) tokens. Return the messages to send, still in chronological order:
user message. If trimming leaves an assistant message first, drop it too.If even the system message exceeds the budget, return just the system message.
Build the architecture on a canvas: place the components, configure them, connect them into a data flow, and write a short reason for each one. The AI reviewer grades your design against a rubric written specifically for this problem.
Minimum 5 components · needs a wide desktop screen