IsContextOverflowError reports whether err indicates the conversation exceeded a provider-side limit (token window, wire size, or media size). Use [OverflowKindOf] to distinguish the three shapes.
(err error)
| 184 | // exceeded a provider-side limit (token window, wire size, or media size). |
| 185 | // Use [OverflowKindOf] to distinguish the three shapes. |
| 186 | func IsContextOverflowError(err error) bool { |
| 187 | if err == nil { |
| 188 | return false |
| 189 | } |
| 190 | if _, ok := errors.AsType[*ContextOverflowError](err); ok { |
| 191 | return true |
| 192 | } |
| 193 | return classifyOverflow(err) != "" |
| 194 | } |
| 195 | |
| 196 | // OverflowKindOf returns the [OverflowKind] of err, or "" if it isn't an |
| 197 | // overflow error. If err is already wrapped in a [*ContextOverflowError] |