diff --git a/internal/llm/provider/anthropic.go b/internal/llm/provider/anthropic.go index 86f483f649a61dca2887ee7d656a73c0769647af..03d96fb249785f721a1c6b42c304ebf17e9d61c4 100644 --- a/internal/llm/provider/anthropic.go +++ b/internal/llm/provider/anthropic.go @@ -59,7 +59,7 @@ func newAnthropicClient(opts providerClientOptions) AnthropicClient { func (a *anthropicClient) convertMessages(messages []message.Message) (anthropicMessages []anthropic.MessageParam) { for i, msg := range messages { cache := false - if len(messages)-3 > i { + if i > len(messages)-3 { cache = true } switch msg.Role { diff --git a/internal/llm/tools/patch.go b/internal/llm/tools/patch.go index 0f879462caf833fd121600153f8b70ff2c85c898..92eab69297a2513530a84a99cf411dc50cc4e359 100644 --- a/internal/llm/tools/patch.go +++ b/internal/llm/tools/patch.go @@ -169,7 +169,7 @@ func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error return NewTextErrorResponse(fmt.Sprintf("failed to parse patch: %s", err)), nil } - if fuzz > 0 { + if fuzz > 3 { return NewTextErrorResponse(fmt.Sprintf("patch contains fuzzy matches (fuzz level: %d). Please make your context lines more precise", fuzz)), nil }