context

context_length error: cause & fix

Context length exceeded

context_lengthmaximum contexttoken limit

Likely cause

The prompt, conversation history or requested output exceeds the model context limit.

Recommended fixes

  1. Shorten prompt and history
  2. Lower max_tokens
  3. Use a model with a larger context window

Related tools