diff --git a/CMakePresets.json b/CMakePresets.json index accdd72d18..b5afeb3c0f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,332 +1,95 @@ { - "version": 4, - "configurePresets": [ - { - "name": "base", - "hidden": true, - "generator": "Ninja", - "binaryDir": "${sourceDir}/build-${presetName}", - "cacheVariables": { - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.." - } - }, - { - "name": "sycl-base", - "hidden": true, - "generator": "Ninja", - "binaryDir": "${sourceDir}/build-${presetName}", - "cacheVariables": { - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", - "CMAKE_CXX_COMPILER": "icx", - "CMAKE_C_COMPILER": "cl", - "GGML_SYCL": "ON", - "CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.." - } - }, - { - "name": "debug", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "release", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "reldbg", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - } - }, - { - "name": "static", - "hidden": true, - "cacheVariables": { - "GGML_STATIC": "ON" - } - }, - { - "name": "sycl_f16", - "hidden": true, - "cacheVariables": { - "GGML_SYCL_F16": "ON" - } - }, - { - "name": "vulkan", - "hidden": true, - "cacheVariables": { - "GGML_VULKAN": "ON" - } - }, - { - "name": "x64-windows-llvm", - "hidden": true, - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/x64-windows-llvm.cmake" - } - }, - { - "name": "arm64-windows-llvm", - "hidden": true, - "architecture": { - "value": "arm64", - "strategy": "external" - }, - "toolset": { - "value": "host=x64", - "strategy": "external" - }, - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-llvm.cmake" - } - }, - { - "name": "arm64-apple-clang", - "hidden": true, - "architecture": { - "value": "arm64", - "strategy": "external" - }, - "toolset": { - "value": "host=x64", - "strategy": "external" - }, - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-apple-clang.cmake" - } - }, - { - "name": "x64-linux-gcc", - "hidden": true, - "cacheVariables": { - "CMAKE_C_COMPILER": "gcc", - "CMAKE_CXX_COMPILER": "g++" - } - }, - { - "name": "x64-linux-gcc-debug", - "inherits": [ - "base", - "x64-linux-gcc", - "debug" - ] - }, - { - "name": "x64-linux-gcc-release", - "inherits": [ - "base", - "x64-linux-gcc", - "release" - ] - }, - { - "name": "x64-linux-gcc-reldbg", - "inherits": [ - "base", - "x64-linux-gcc", - "reldbg" - ] - }, - { - "name": "x64-linux-gcc+static-release", - "inherits": [ - "base", - "x64-linux-gcc", - "release", - "static" - ] - }, - { - "name": "arm64-windows-llvm-debug", - "inherits": [ - "base", - "arm64-windows-llvm", - "debug" - ] - }, - { - "name": "arm64-windows-llvm-release", - "inherits": [ - "base", - "arm64-windows-llvm", - "reldbg" - ] - }, - { - "name": "arm64-windows-llvm+static-release", - "inherits": [ - "base", - "arm64-windows-llvm", - "reldbg", - "static" - ] - }, - { - "name": "arm64-apple-clang-debug", - "inherits": [ - "base", - "arm64-apple-clang", - "debug" - ] - }, - { - "name": "arm64-apple-clang-release", - "inherits": [ - "base", - "arm64-apple-clang", - "reldbg" - ] - }, - { - "name": "arm64-apple-clang+static-release", - "inherits": [ - "base", - "arm64-apple-clang", - "reldbg", - "static" - ] - }, - { - "name": "x64-windows-llvm-debug", - "inherits": [ - "base", - "x64-windows-llvm", - "debug" - ] - }, - { - "name": "x64-windows-llvm-release", - "inherits": [ - "base", - "x64-windows-llvm", - "release" - ] - }, - { - "name": "x64-windows-llvm-reldbg", - "inherits": [ - "base", - "x64-windows-llvm", - "reldbg" - ] - }, - { - "name": "x64-windows-llvm+static-release", - "inherits": [ - "base", - "x64-windows-llvm", - "reldbg", - "static" - ] - }, - { - "name": "x64-windows-msvc-debug", - "inherits": [ - "base", - "debug" - ] - }, - { - "name": "x64-windows-msvc-release", - "inherits": [ - "base", - "reldbg" - ] - }, - { - "name": "x64-windows-msvc+static-release", - "inherits": [ - "base", - "reldbg", - "static" - ] - }, - { - "name": "x64-windows-sycl-debug", - "inherits": [ - "sycl-base", - "debug" - ] - }, - { - "name": "x64-windows-sycl-debug-f16", - "inherits": [ - "sycl-base", - "debug", - "sycl_f16" - ] - }, - { - "name": "x64-windows-sycl-release", - "inherits": [ - "sycl-base", - "release" - ] - }, - { - "name": "x64-windows-sycl-release-f16", - "inherits": [ - "sycl-base", - "release", - "sycl_f16" - ] - }, - { - "name": "x64-windows-vulkan-debug", - "inherits": [ - "base", - "vulkan", - "debug" - ] - }, - { - "name": "x64-windows-vulkan-release", - "inherits": [ - "base", - "vulkan", - "release" - ] - }, - { - "name": "ilintar-release", - "hidden": false, - "description": "Release build", - "displayName": "Release build", - "binaryDir": "${sourceDir}/build", - "cacheVariables": { - "GGML_CUDA": "ON", - "GGML_CUDA_FORCE_CUBLAS": "OFF", - "GGML_CUDA_FORCE_MMQ": "OFF", - "GGML_CUDA_FA_ALL_QUANTS": "1", - "CMAKE_CUDA_ARCHITECTURES": "86;120", - "GGML_BLAS": "ON", - "GGML_BLAS_VENDOR": "OpenBLAS", - "GGML_CPU_ALL_VARIANTS": "ON", - "GGML_BACKEND_DL": "ON", - "CMAKE_CUDA_COMPILER": "nvcc" - }, - "inherits": [ - "base", - "release", - "x64-linux-gcc-release" - ] + "version": 4, + "configurePresets": [ + { + "name": "base", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-${presetName}", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.." } - ], - "buildPresets": [ - { - "name": "parallel", - "description": "Parallel build", - "displayName": "Parallel build", - "configurePreset": "ilintar-release", - "jobs": 8 + }, + { + "name": "sycl-base", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-${presetName}", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_CXX_COMPILER": "icx", + "CMAKE_C_COMPILER": "cl", + "GGML_SYCL": "ON", + "CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.." } - ] -} \ No newline at end of file + }, + { "name": "debug", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } }, + { "name": "release", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } }, + { "name": "reldbg", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, + { "name": "static", "hidden": true, "cacheVariables": { "GGML_STATIC": "ON" } }, + { "name": "sycl_f16", "hidden": true, "cacheVariables": { "GGML_SYCL_F16": "ON" } }, + { "name": "vulkan", "hidden": true, "cacheVariables": { "GGML_VULKAN": "ON" } }, + + { + "name": "x64-windows-llvm", "hidden": true, + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/x64-windows-llvm.cmake" + } + }, + + { + "name": "arm64-windows-llvm", "hidden": true, + "architecture": { "value": "arm64", "strategy": "external" }, + "toolset": { "value": "host=x64", "strategy": "external" }, + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-llvm.cmake" + } + }, + + { + "name": "arm64-apple-clang", "hidden": true, + "architecture": { "value": "arm64", "strategy": "external" }, + "toolset": { "value": "host=x64", "strategy": "external" }, + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-apple-clang.cmake" + } + }, + { + "name": "x64-linux-gcc", "hidden": true, + "cacheVariables": { + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++" + } + }, + { "name": "x64-linux-gcc-debug", "inherits": [ "base", "x64-linux-gcc", "debug" ] }, + { "name": "x64-linux-gcc-release", "inherits": [ "base", "x64-linux-gcc", "release" ] }, + { "name": "x64-linux-gcc-reldbg", "inherits": [ "base", "x64-linux-gcc", "reldbg" ] }, + { "name": "x64-linux-gcc+static-release", "inherits": [ "base", "x64-linux-gcc", "release", "static" ] }, + + { "name": "arm64-windows-llvm-debug", "inherits": [ "base", "arm64-windows-llvm", "debug" ] }, + { "name": "arm64-windows-llvm-release", "inherits": [ "base", "arm64-windows-llvm", "reldbg" ] }, + { "name": "arm64-windows-llvm+static-release", "inherits": [ "base", "arm64-windows-llvm", "reldbg", "static" ] }, + + { "name": "arm64-apple-clang-debug", "inherits": [ "base", "arm64-apple-clang", "debug" ] }, + { "name": "arm64-apple-clang-release", "inherits": [ "base", "arm64-apple-clang", "reldbg" ] }, + { "name": "arm64-apple-clang+static-release", "inherits": [ "base", "arm64-apple-clang", "reldbg", "static" ] }, + + { "name": "x64-windows-llvm-debug", "inherits": [ "base", "x64-windows-llvm", "debug" ] }, + { "name": "x64-windows-llvm-release", "inherits": [ "base", "x64-windows-llvm", "release" ] }, + { "name": "x64-windows-llvm-reldbg", "inherits": [ "base", "x64-windows-llvm", "reldbg" ] }, + { "name": "x64-windows-llvm+static-release", "inherits": [ "base", "x64-windows-llvm", "reldbg", "static" ] }, + + { "name": "x64-windows-msvc-debug", "inherits": [ "base", "debug" ] }, + { "name": "x64-windows-msvc-release", "inherits": [ "base", "reldbg" ] }, + { "name": "x64-windows-msvc+static-release", "inherits": [ "base", "reldbg", "static" ] }, + + { "name": "x64-windows-sycl-debug", "inherits": [ "sycl-base", "debug" ] }, + { "name": "x64-windows-sycl-debug-f16", "inherits": [ "sycl-base", "debug", "sycl_f16" ] }, + { "name": "x64-windows-sycl-release", "inherits": [ "sycl-base", "release" ] }, + { "name": "x64-windows-sycl-release-f16", "inherits": [ "sycl-base", "release", "sycl_f16" ] }, + + { "name": "x64-windows-vulkan-debug", "inherits": [ "base", "vulkan", "debug" ] }, + { "name": "x64-windows-vulkan-release", "inherits": [ "base", "vulkan", "release" ] } + ] +} diff --git a/common/chat-auto-parser-generator.cpp b/common/chat-auto-parser-generator.cpp index a721a30f1c..ba0cf66b08 100644 --- a/common/chat-auto-parser-generator.cpp +++ b/common/chat-auto-parser-generator.cpp @@ -26,7 +26,7 @@ common_chat_params universal_peg_generator::generate_parser(const common_chat_te return generate_parser(tmpl, inputs, analysis); } -common_chat_params universal_peg_generator::generate_parser(const common_chat_template & tmpl, +common_chat_params universal_peg_generator::generate_parser(const common_chat_template & tmpl, const struct templates_params & inputs, const diff_analysis_result & analysis) { // Check for thinking forced open @@ -120,9 +120,8 @@ common_peg_arena universal_peg_generator::build_parser(const diff_analysis_resul if (extracting_reasoning) { return reasoning + m.content_start + p.content(p.until(m.content_end)) + m.content_end + p.end(); - } - return p.content(p.until(m.content_start)) + m.content_start + - p.content(p.until(m.content_end)) + m.content_end + p.end(); + } + return p.content(p.until(m.content_start)) + m.content_start + p.content(p.until(m.content_end)) + m.content_end + p.end(); } return reasoning + p.content(p.rest()) + p.end(); }); @@ -358,4 +357,4 @@ common_peg_parser universal_peg_generator::build_tool_parser( } GGML_ABORT("Unable to create tool parser"); -} \ No newline at end of file +} diff --git a/common/chat-auto-parser-helpers.cpp b/common/chat-auto-parser-helpers.cpp index 4bf27f1dcb..d2aec2d9bb 100644 --- a/common/chat-auto-parser-helpers.cpp +++ b/common/chat-auto-parser-helpers.cpp @@ -38,17 +38,17 @@ std::string trim_trailing_whitespace(const std::string & str) { if (str.empty()) { return ""; } - + size_t end = str.length() - 1; while (end > 0 && std::isspace(static_cast(str[end]))) { end--; } - + // If first char is also whitespace, return empty string if (end == 0 && std::isspace(static_cast(str[0]))) { return ""; } - + return str.substr(0, end + 1); } diff --git a/common/chat-auto-parser-helpers.h b/common/chat-auto-parser-helpers.h index 445119be8e..53d3454566 100644 --- a/common/chat-auto-parser-helpers.h +++ b/common/chat-auto-parser-helpers.h @@ -22,4 +22,4 @@ std::string after_common_suffix(const std::string & full, const std::string & le std::vector segmentize_markers(const std::string & text); // Prune whitespace-only segments from a vector of segments -std::vector prune_whitespace_segments(const std::vector & segments); \ No newline at end of file +std::vector prune_whitespace_segments(const std::vector & segments); diff --git a/common/chat-diff-analyzer.cpp b/common/chat-diff-analyzer.cpp index 0082e3ab77..53906102d8 100644 --- a/common/chat-diff-analyzer.cpp +++ b/common/chat-diff-analyzer.cpp @@ -192,7 +192,6 @@ std::optional differential_analyzer::compare_variants( if (params_modifier) { params_modifier(params_B); } - // Apply template to both variants std::string output_A = apply_template(tmpl, params_A); diff --git a/common/chat-diff-analyzer.h b/common/chat-diff-analyzer.h index b1c601181e..7933de5ce3 100644 --- a/common/chat-diff-analyzer.h +++ b/common/chat-diff-analyzer.h @@ -97,7 +97,7 @@ enum class reasoning_mode { TAG_BASED, // Standard tag-based: ... DELIMITER, // Delimiter-based: [BEGIN FINAL RESPONSE] (reasoning ends at delimiter) FORCED_OPEN, // Template ends with open reasoning tag (empty start, non-empty end) - FORCED_CLOSED,// Template ends with open reasoning tag on enabled thinking but + FORCED_CLOSED,// Template ends with open reasoning tag on enabled thinking but // with both opened and closed tag for disabled thinking TOOLS_ONLY // Only reason on tool calls, not on normal content }; @@ -281,7 +281,7 @@ class differential_analyzer { const std::string & fun_name_needle, const std::string & arg_name_needle, diff_analysis_result & result); - + static void analyze_tool_call_format_non_json(const std::string & clean_haystack, const std::string & fun_name_needle, diff_analysis_result & result); @@ -324,7 +324,7 @@ class differential_analyzer { }; enum segment_type { - TEXT, + TEXT, MARKER }; @@ -344,4 +344,4 @@ struct segment { std::string value; segment(segment_type type, std::string value) : type(type), value(std::move(value)) {} -}; \ No newline at end of file +}; diff --git a/common/chat.cpp b/common/chat.cpp index a19760a5de..4a652fb555 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -1078,39 +1078,22 @@ static common_chat_params common_chat_params_init_functionary_v3_2(const common_ tool_choice |= p.rule("tool-" + name, tool_parser); }); - // The model can output: - // 1. Just content: >>>all\n{content} - // 2. Just tool call(s): >>>function_name\n{json_args} - // 3. Both: >>>all\n{content}>>>function_name\n{json_args} - - // Option 1: Content only (no following tool call) auto content_only = content_until_end; - - // Option 2: Content followed by tool call(s) auto content_and_tools = content_until_tool + p.one_or_more(tool_choice); - - // Option 3: Just tool call(s) (no content) - auto tools_only = p.one_or_more(tool_choice); + auto tools_only = p.one_or_more(tool_choice); if (inputs.tool_choice == COMMON_CHAT_TOOL_CHOICE_REQUIRED) { - // Must have at least one tool call if (inputs.parallel_tool_calls) { - // Multiple tool calls allowed return p.choice({ content_and_tools, tools_only }) + p.end(); } else { - // Single tool call only return p.choice({ content_until_tool + tool_choice, tools_only }) + p.end(); } } else { - // Tool calls are optional (auto mode) if (inputs.parallel_tool_calls) { - // Multiple tool calls allowed return p.choice({ content_and_tools, content_only, tools_only }) + p.end(); - } else { - // Single tool call at most - auto content_and_tool = content_until_tool + tool_choice; - return p.choice({ content_and_tool, content_only, tool_choice }) + p.end(); } + auto content_and_tool = content_until_tool + tool_choice; + return p.choice({ content_and_tool, content_only, tool_choice }) + p.end(); } }); @@ -1213,7 +1196,7 @@ static common_chat_params common_chat_templates_apply_jinja(const struct common_ if (tmpl.original_caps().supports_tool_calls) { // some templates will require the content field in tool call messages - // to still be non-null, this puts an empty string everywhere where the + // to still be non-null, this puts an empty string everywhere where the // content field is null workaround::requires_non_null_content(params.messages); } diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp index efd2c8ef95..57a14dc9f4 100644 --- a/common/json-schema-to-grammar.cpp +++ b/common/json-schema-to-grammar.cpp @@ -27,10 +27,10 @@ static std::string build_repetition(const std::string & item_rule, int min_items if (separator_rule.empty()) { if (min_items == 1 && !has_max) { return item_rule + "+"; - } + } if (min_items == 0 && !has_max) { return item_rule + "*"; - } + } return item_rule + "{" + std::to_string(min_items) + "," + (has_max ? std::to_string(max_items) : "") + "}"; } @@ -828,11 +828,11 @@ public: if (schema.contains("$ref")) { return _add_rule(rule_name, _resolve_ref(schema["$ref"])); - } + } 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)); - } + } if (schema_type.is_array()) { std::vector schema_types; for (const auto & t : schema_type) { @@ -841,17 +841,17 @@ public: schema_types.push_back(schema_copy); } return _add_rule(rule_name, _generate_union_rule(name, schema_types)); - } + } if (schema.contains("const")) { return _add_rule(rule_name, _generate_constant_rule(schema["const"]) + " space"); - } + } if (schema.contains("enum")) { std::vector enum_values; for (const auto & v : schema["enum"]) { enum_values.push_back(_generate_constant_rule(v)); } return _add_rule(rule_name, "(" + string_join(enum_values, " | ") + ") space"); - } + } if ((schema_type.is_null() || schema_type == "object") && (schema.contains("properties") || (schema.contains("additionalProperties") && schema["additionalProperties"] != true))) { @@ -873,7 +873,7 @@ public: _build_object_rule( properties, required, name, schema.contains("additionalProperties") ? schema["additionalProperties"] : json())); - } + } if ((schema_type.is_null() || schema_type == "object" || schema_type == "string") && schema.contains("allOf")) { std::unordered_set required; std::vector> properties; @@ -922,7 +922,7 @@ public: } } return _add_rule(rule_name, _build_object_rule(properties, required, hybrid_name, json())); - } + } if ((schema_type.is_null() || schema_type == "array") && (schema.contains("items") || schema.contains("prefixItems"))) { json items = schema.contains("items") ? schema["items"] : schema["prefixItems"]; if (items.is_array()) { @@ -942,23 +942,23 @@ public: int max_items = max_items_json.is_number_integer() ? max_items_json.get() : std::numeric_limits::max(); return _add_rule(rule_name, "\"[\" space " + build_repetition(item_rule_name, min_items, max_items, "\",\" space") + " \"]\" space"); - } + } if ((schema_type.is_null() || schema_type == "string") && schema.contains("pattern")) { return _visit_pattern(schema["pattern"], rule_name); - } + } if ((schema_type.is_null() || schema_type == "string") && std::regex_match(schema_format, std::regex("^uuid[1-5]?$"))) { return _add_primitive(rule_name == "root" ? "root" : schema_format, PRIMITIVE_RULES.at("uuid")); - } + } if ((schema_type.is_null() || schema_type == "string") && STRING_FORMAT_RULES.find(schema_format + "-string") != STRING_FORMAT_RULES.end()) { auto prim_name = schema_format + "-string"; return _add_rule(rule_name, _add_primitive(prim_name, STRING_FORMAT_RULES.at(prim_name))); - } + } if (schema_type == "string" && (schema.contains("minLength") || schema.contains("maxLength"))) { std::string char_rule = _add_primitive("char", PRIMITIVE_RULES.at("char")); int min_len = schema.contains("minLength") ? schema["minLength"].get() : 0; int max_len = schema.contains("maxLength") ? schema["maxLength"].get() : std::numeric_limits::max(); return _add_rule(rule_name, "\"\\\"\" " + build_repetition(char_rule, min_len, max_len) + " \"\\\"\" space"); - } + } if (schema_type == "integer" && (schema.contains("minimum") || schema.contains("exclusiveMinimum") || schema.contains("maximum") || schema.contains("exclusiveMaximum"))) { int64_t min_value = std::numeric_limits::min(); int64_t max_value = std::numeric_limits::max(); @@ -977,10 +977,10 @@ public: build_min_max_int(min_value, max_value, out); out << ") space"; return _add_rule(rule_name, out.str()); - } + } if (schema.empty() || schema_type == "object") { return _add_rule(rule_name, _add_primitive("object", PRIMITIVE_RULES.at("object"))); - } + } if (!schema_type.is_string() || PRIMITIVE_RULES.find(schema_type.get()) == PRIMITIVE_RULES.end()) { _errors.push_back("Unrecognized schema: " + schema.dump()); return ""; diff --git a/common/peg-parser.h b/common/peg-parser.h index 9bd5e05838..947c775f10 100644 --- a/common/peg-parser.h +++ b/common/peg-parser.h @@ -318,16 +318,16 @@ class common_peg_parser_builder { common_peg_parser wrap(common_peg_parser_id id) { return common_peg_parser(id, *this); } common_peg_parser add(const common_peg_parser_variant & p) { return wrap(arena_.add_parser(p)); } - - bool allow_python_dict_format_ = false; + + bool allow_python_dict_format_ = false; public: common_peg_parser_builder(); - - // Enable/disable Python dict format support (single-quoted strings). - // When enabled, JSON parsers will also accept Python dict-style single-quoted strings. - void set_allow_python_dict_format(bool allow) { allow_python_dict_format_ = allow; } - bool get_allow_python_dict_format() const { return allow_python_dict_format_; } + + // Enable/disable Python dict format support (single-quoted strings). + // When enabled, JSON parsers will also accept Python dict-style single-quoted strings. + void set_allow_python_dict_format(bool allow) { allow_python_dict_format_ = allow; } + bool get_allow_python_dict_format() const { return allow_python_dict_format_; } // Match nothing, always succeed. // S -> ε diff --git a/tests/test-chat-auto-parser.cpp b/tests/test-chat-auto-parser.cpp index 298a1b50bd..04122e9fae 100644 --- a/tests/test-chat-auto-parser.cpp +++ b/tests/test-chat-auto-parser.cpp @@ -117,7 +117,7 @@ static void test_marker_separation(testing & t) { t.assert_equal("second is '[marker]'", "[marker]", single_square_marker[1].value); t.assert_equal("last is 'post_marker'", "post_marker", single_square_marker[2].value); }); - + t.test("single_diagonal_marker", [&] (testing & t) { t.assert_equal("first is text", segment_type::TEXT, single_diag_marker[0].type); t.assert_equal("second is marker", segment_type::MARKER, single_diag_marker[1].type); @@ -1219,7 +1219,7 @@ static common_chat_template load_template(testing & t, const std::string & templ common_chat_template tmpl(template_source, "", ""); t.assert_true("Nemotron template loaded successfully", template_source.length() > 0); return tmpl; -} +} // ============================================================================ // Nemotron Template Analysis Tests diff --git a/tests/test-chat-template.cpp b/tests/test-chat-template.cpp index e21dbb04d1..48aac31d75 100644 --- a/tests/test-chat-template.cpp +++ b/tests/test-chat-template.cpp @@ -66,7 +66,7 @@ int main(int argc, char ** argv) { if (args[i] == "--help" || args[i] == "-h") { std::cout << HELP << "\n"; return 0; - } + } if (args[i] == "--json" && i + 1 < args.size()) { json_path = args[i + 1]; i++; @@ -623,4 +623,4 @@ int main_automated_tests(void) { std::cout << "\nOK: All tests passed successfully.\n"; return 0; -} \ No newline at end of file +} diff --git a/tests/test-chat.cpp b/tests/test-chat.cpp index 3d4a66217f..5db03cc1c0 100644 --- a/tests/test-chat.cpp +++ b/tests/test-chat.cpp @@ -822,7 +822,7 @@ static void test_peg_parser(common_chat_templates * tmpls, } catch (std::exception & e) { throw std::runtime_error((std::string("Error comparing accumulated message to current: ") + e.what()).c_str()); } - + msg_prev = msg_current; } diff --git a/tools/parser/debug-template-parser.cpp b/tools/parser/debug-template-parser.cpp index b8b4f3dfd3..06ceb0f02f 100644 --- a/tools/parser/debug-template-parser.cpp +++ b/tools/parser/debug-template-parser.cpp @@ -441,7 +441,7 @@ int main(int argc, char ** argv) { LOG_ERR("args_field: '%s'\n", analysis.args_field.c_str()); LOG_ERR("id_field: '%s'\n", analysis.id_field.c_str()); LOG_ERR("gen_id_field: '%s'\n", analysis.gen_id_field.c_str()); - LOG_ERR("parameter_order: '%s'\n", std::accumulate(analysis.parameter_order.begin(), analysis.parameter_order.end(), + LOG_ERR("parameter_order: '%s'\n", std::accumulate(analysis.parameter_order.begin(), analysis.parameter_order.end(), std::string(""), [] (const std::string & a, const std::string & b) { return a.empty() ? b : a + ", " + b; } ).c_str());