claudetool: add simplified patch support
For weaker models.
Also, improve fallback parsing introduced earlier.
diff --git a/llm/ant/ant.go b/llm/ant/ant.go
index 046456f..7be2911 100644
--- a/llm/ant/ant.go
+++ b/llm/ant/ant.go
@@ -565,3 +565,8 @@
}
}
}
+
+// For debugging only, Claude can definitely handle the full patch tool.
+// func (s *Service) UseSimplifiedPatch() bool {
+// return true
+// }
diff --git a/llm/llm.go b/llm/llm.go
index ffaad3e..19a1d8d 100644
--- a/llm/llm.go
+++ b/llm/llm.go
@@ -21,6 +21,18 @@
TokenContextWindow() int
}
+type SimplifiedPatcher interface {
+ // UseSimplifiedPatch reports whether the service should use the simplified patch input schema.
+ UseSimplifiedPatch() bool
+}
+
+func UseSimplifiedPatch(svc Service) bool {
+ if sp, ok := svc.(SimplifiedPatcher); ok {
+ return sp.UseSimplifiedPatch()
+ }
+ return false
+}
+
// MustSchema validates that schema is a valid JSON schema and returns it as a json.RawMessage.
// It panics if the schema is invalid.
// The schema must have at least type="object" and a properties key.
diff --git a/llm/oai/oai.go b/llm/oai/oai.go
index c561095..6a32a74 100644
--- a/llm/oai/oai.go
+++ b/llm/oai/oai.go
@@ -37,11 +37,12 @@
)
type Model struct {
- UserName string // provided by the user to identify this model (e.g. "gpt4.1")
- ModelName string // provided to the service provide to specify which model to use (e.g. "gpt-4.1-2025-04-14")
- URL string
- APIKeyEnv string // environment variable name for the API key
- IsReasoningModel bool // whether this model is a reasoning model (e.g. O3, O4-mini)
+ UserName string // provided by the user to identify this model (e.g. "gpt4.1")
+ ModelName string // provided to the service provide to specify which model to use (e.g. "gpt-4.1-2025-04-14")
+ URL string
+ APIKeyEnv string // environment variable name for the API key
+ IsReasoningModel bool // whether this model is a reasoning model (e.g. O3, O4-mini)
+ UseSimplifiedPatch bool // whether to use the simplified patch input schema; defaults to false
}
var (
@@ -210,17 +211,19 @@
}
Qwen3CoderFireworks = Model{
- UserName: "qwen3-coder-fireworks",
- ModelName: "accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",
- URL: FireworksURL,
- APIKeyEnv: FireworksAPIKeyEnv,
+ UserName: "qwen3-coder-fireworks",
+ ModelName: "accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",
+ URL: FireworksURL,
+ APIKeyEnv: FireworksAPIKeyEnv,
+ UseSimplifiedPatch: true,
}
// Qwen is a skaband-specific model name for Qwen3-Coder
// Provider details (URL and APIKeyEnv) are handled by skaband
Qwen = Model{
- UserName: "qwen",
- ModelName: "qwen", // skaband will map this to the actual provider model
+ UserName: "qwen",
+ ModelName: "qwen", // skaband will map this to the actual provider model
+ UseSimplifiedPatch: true,
}
)
@@ -783,3 +786,7 @@
}
}
}
+
+func (s *Service) UseSimplifiedPatch() bool {
+ return s.Model.UseSimplifiedPatch
+}