chore: update llama-cpp
This commit is contained in:
@@ -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<std::string> required;
|
|
||||||
std::vector<std::pair<std::string, json>> properties;
|
|
||||||
@@ -7,12 +7,12 @@
|
|||||||
vulkanSupport = true;
|
vulkanSupport = true;
|
||||||
}).overrideAttrs
|
}).overrideAttrs
|
||||||
(oldAttrs: rec {
|
(oldAttrs: rec {
|
||||||
version = "8229";
|
version = "8680";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "ggml-org";
|
owner = "ggml-org";
|
||||||
repo = "llama.cpp";
|
repo = "llama.cpp";
|
||||||
tag = "b${version}";
|
tag = "b${version}";
|
||||||
hash = "sha256-SmCNsQfLQMmwa8PzFPaQb9yBdUZTxM8xxSqhumVGvHM=";
|
hash = "sha256-tJCA19BQs0vZc0VjPnbIrh3CJFxyPL6Ne4oIG4gfozw=";
|
||||||
leaveDotGit = true;
|
leaveDotGit = true;
|
||||||
postFetch = ''
|
postFetch = ''
|
||||||
git -C "$out" rev-parse --short HEAD > $out/COMMIT
|
git -C "$out" rev-parse --short HEAD > $out/COMMIT
|
||||||
|
|||||||
@@ -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<json> alt_schemas = schema.contains("oneOf") ? schema["oneOf"].get<std::vector<json>>() : schema["anyOf"].get<std::vector<json>>();
|
|
||||||
- return _add_rule(rule_name, _generate_union_rule(name, alt_schemas));
|
|
||||||
+ std::vector<json> 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<json> schema_types;
|
|
||||||
for (const auto & t : schema_type) {
|
|
||||||
Reference in New Issue
Block a user