Failure
A turn that fell over, and what it fell over on. The sentence is for whoever asked; the diagnostics, folded away, are for whoever works on the assistant.
With details and a retry
Render it below a turn's body, never in its place: a reply cut off at the context limit still has its answer above.
Assistant said
Here's the shortlist so far: Ana Silva, Grace Okafor, and
RubyLLM::ContextLengthExceededError: prompt is too long: 212,408 tokens > 200,000 maximum
Details
Provider said
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "prompt is too long"
}
}Where it happened
app/models/chat.rb:88:in 'Chat#reply'
app/jobs/reply_job.rb:6:in 'ReplyJob#perform'<div class="mx-auto max-w-2xl">
<%= ai_chat_message role: :assistant do %>
<p>Here's the shortlist so far: Ana Silva, Grace Okafor, and</p>
<% end %>
<%= ai_chat_failure "The assistant couldn't finish this reply.", class: "mt-2" do |failure| %>
<% failure.cause "RubyLLM::ContextLengthExceededError: prompt is too long: 212,408 tokens > 200,000 maximum" %>
<% failure.detail "Provider said", { type: "error", error: { type: "invalid_request_error", message: "prompt is too long" } } %>
<% failure.detail "Where it happened", "app/models/chat.rb:88:in 'Chat#reply'\napp/jobs/reply_job.rb:6:in 'ReplyJob#perform'", language: :plaintext %>
<% failure.retry { button_to "Try again", "#", class: button_classes(size: :small) } %>
<% end %>
</div>Just the sentence
A turn that failed before anything was recorded.
<div class="mx-auto max-w-2xl">
<%= ai_chat_failure "Something went wrong before the assistant could start. Nothing was changed." %>
</div>