IsContextOverflow (llm/retry.go)

gortex · internal/llm/retry.go · go · Apache-2.0
ai

Detects LLM context overflow errors across providers for adaptive retry.

// Source: https://github.com/zzet/gortex | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Package llm — context-overflow classification for adaptive retry.
//
// When a request's prompt exceeds the model's context window, every
// provider fails it — but each phrases the error differently (the
// HTTP providers relay their API's wording, the local llama.cpp
// provider its own, the CLI providers whatever their binary printed).
// IsContextOverflow recognises that failure mode across all of them so
// the assist layer can react to it (see the svc package's adaptive
// chunk-bisection retry) instead of surfacing a hard error.
package llm

import "strings"

// contextOverflowMarke

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key