claudetool: add simplified patch support
For weaker models.
Also, improve fallback parsing introduced earlier.
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.