From d5942d9fb0aa2434bddfac9e16faa45d45f945b5 Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Mon, 6 Apr 2026 16:07:16 -0400 Subject: [PATCH] chore: update llama-cpp --- .../additionalprops-unrecognized-schema.patch | 31 ------------------- packages/llama-cpp/default.nix | 4 +-- .../oneof-not-unrecognized-schema.patch | 28 ----------------- 3 files changed, 2 insertions(+), 61 deletions(-) delete mode 100644 packages/llama-cpp/additionalprops-unrecognized-schema.patch delete mode 100644 packages/llama-cpp/oneof-not-unrecognized-schema.patch diff --git a/packages/llama-cpp/additionalprops-unrecognized-schema.patch b/packages/llama-cpp/additionalprops-unrecognized-schema.patch deleted file mode 100644 index 47bc508..0000000 --- a/packages/llama-cpp/additionalprops-unrecognized-schema.patch +++ /dev/null @@ -1,31 +0,0 @@ -# This patch modifies the json-schema-to-grammar.cpp file to handle 'not: {}' constructs -# specifically inside additionalProperties. -# -# Author: https://github.com/evanreichard - -diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp -index c3b4e5d..ea24bc3 100644 ---- a/common/json-schema-to-grammar.cpp -+++ b/common/json-schema-to-grammar.cpp -@@ -858,10 +858,19 @@ public: - properties.emplace_back(prop.key(), prop.value()); - } - } -+ json additionalProps = schema.contains("additionalProperties") ? schema["additionalProperties"] : json(); -+ if (additionalProps.is_object() && additionalProps.contains("not")) { -+ const auto& not_val = additionalProps["not"]; -+ if (not_val.is_object() && not_val.empty()) { -+ additionalProps.erase("not"); -+ if (additionalProps.empty()) { -+ additionalProps = false; -+ } -+ } -+ } - return _add_rule(rule_name, - _build_object_rule( -- properties, required, name, -- schema.contains("additionalProperties") ? schema["additionalProperties"] : json())); -+ properties, required, name, additionalProps)); - } else if ((schema_type.is_null() || schema_type == "object" || schema_type == "string") && schema.contains("allOf")) { - std::unordered_set required; - std::vector> properties; diff --git a/packages/llama-cpp/default.nix b/packages/llama-cpp/default.nix index 326ad08..adfd2b1 100644 --- a/packages/llama-cpp/default.nix +++ b/packages/llama-cpp/default.nix @@ -7,12 +7,12 @@ vulkanSupport = true; }).overrideAttrs (oldAttrs: rec { - version = "8229"; + version = "8680"; src = pkgs.fetchFromGitHub { owner = "ggml-org"; repo = "llama.cpp"; tag = "b${version}"; - hash = "sha256-SmCNsQfLQMmwa8PzFPaQb9yBdUZTxM8xxSqhumVGvHM="; + hash = "sha256-tJCA19BQs0vZc0VjPnbIrh3CJFxyPL6Ne4oIG4gfozw="; leaveDotGit = true; postFetch = '' git -C "$out" rev-parse --short HEAD > $out/COMMIT diff --git a/packages/llama-cpp/oneof-not-unrecognized-schema.patch b/packages/llama-cpp/oneof-not-unrecognized-schema.patch deleted file mode 100644 index 20749de..0000000 --- a/packages/llama-cpp/oneof-not-unrecognized-schema.patch +++ /dev/null @@ -1,28 +0,0 @@ -# This patch modifies the json-schema-to-grammar.cpp file to handle 'not: {}' constructs. -# -# Author: https://github.com/simaotwx -# Reference: https://github.com/ggml-org/llama.cpp/issues/14227#issuecomment-3547740835 - -diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp -index 478aa1be7..ec0b3b73e 100644 ---- a/common/json-schema-to-grammar.cpp -+++ b/common/json-schema-to-grammar.cpp -@@ -822,7 +822,17 @@ public: - return _add_rule(rule_name, _resolve_ref(schema["$ref"])); - } else if (schema.contains("oneOf") || schema.contains("anyOf")) { - std::vector alt_schemas = schema.contains("oneOf") ? schema["oneOf"].get>() : schema["anyOf"].get>(); -- return _add_rule(rule_name, _generate_union_rule(name, alt_schemas)); -+ std::vector filtered_schemas; -+ for (const auto& alt : alt_schemas) { -+ if (alt.is_object() && alt.contains("not")) { -+ const auto& not_val = alt["not"]; -+ if (not_val.is_object() && not_val.empty()) { -+ continue; -+ } -+ } -+ filtered_schemas.push_back(alt); -+ } -+ return _add_rule(rule_name, _generate_union_rule(name, filtered_schemas)); - } else if (schema_type.is_array()) { - std::vector schema_types; - for (const auto & t : schema_type) {