on main help sign in
chore: fix max tokens limit
commit9a2d0c2db6106055baa00efae3f2e1f10bc24ccf authorKujtim Hoxha <kujtimii.h@gmail.com> dateSat 5 Jul 2025, 19:09 (1 year ago) parentcd60668
1 file changed+2−1
internal/llm/provider/anthropic.go+2−1
internal/llm/provider/anthropic.go+2−1
@@ -438,7 +438,8 @@ func (a *anthropicClient) shouldRetry(attempts int, err error) (bool, int64, err
438438func (a *anthropicClient) handleContextLimitError(apiErr *anthropic.Error) (int, bool) {
439439 // Parse error message like: "input length and max_tokens exceed context limit: 154978 + 50000 > 200000"
440440 errorMsg := apiErr.Error()
441− re := regexp.MustCompile(`input length and max_tokens exceed context limit: (\d+) \+ (\d+) > (\d+)`)
441+
442+ re := regexp.MustCompile("input length and `max_tokens` exceed context limit: (\\d+) \\+ (\\d+) > (\\d+)")
442443 matches := re.FindStringSubmatch(errorMsg)
443444
444445 if len(matches) != 4 {