Feeding the hungry editor checker god.

This commit is contained in:
Piotr Wilkin 2026-02-03 17:40:05 +01:00
parent c35b31abe5
commit f1937febff
13 changed files with 137 additions and 393 deletions

View File

@ -1,332 +1,95 @@
{ {
"version": 4, "version": 4,
"configurePresets": [ "configurePresets": [
{ {
"name": "base", "name": "base",
"hidden": true, "hidden": true,
"generator": "Ninja", "generator": "Ninja",
"binaryDir": "${sourceDir}/build-${presetName}", "binaryDir": "${sourceDir}/build-${presetName}",
"cacheVariables": { "cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.." "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"
]
} }
], },
"buildPresets": [ {
{ "name": "sycl-base",
"name": "parallel", "hidden": true,
"description": "Parallel build", "generator": "Ninja",
"displayName": "Parallel build", "binaryDir": "${sourceDir}/build-${presetName}",
"configurePreset": "ilintar-release", "cacheVariables": {
"jobs": 8 "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" ] }
]
} }

View File

@ -121,8 +121,7 @@ common_peg_arena universal_peg_generator::build_parser(const diff_analysis_resul
if (extracting_reasoning) { if (extracting_reasoning) {
return reasoning + m.content_start + p.content(p.until(m.content_end)) + m.content_end + p.end(); 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 + return p.content(p.until(m.content_start)) + m.content_start + p.content(p.until(m.content_end)) + m.content_end + p.end();
p.content(p.until(m.content_end)) + m.content_end + p.end();
} }
return reasoning + p.content(p.rest()) + p.end(); return reasoning + p.content(p.rest()) + p.end();
}); });

View File

@ -193,7 +193,6 @@ std::optional<compare_variants_result> differential_analyzer::compare_variants(
params_modifier(params_B); params_modifier(params_B);
} }
// Apply template to both variants // Apply template to both variants
std::string output_A = apply_template(tmpl, params_A); std::string output_A = apply_template(tmpl, params_A);
std::string output_B = apply_template(tmpl, params_B); std::string output_B = apply_template(tmpl, params_B);

View File

@ -1109,39 +1109,22 @@ static common_chat_params common_chat_params_init_functionary_v3_2(const common_
tool_choice |= p.rule("tool-" + name, tool_parser); 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; 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); auto content_and_tools = content_until_tool + p.one_or_more(tool_choice);
auto tools_only = p.one_or_more(tool_choice);
// Option 3: Just tool call(s) (no content)
auto tools_only = p.one_or_more(tool_choice);
if (inputs.tool_choice == COMMON_CHAT_TOOL_CHOICE_REQUIRED) { if (inputs.tool_choice == COMMON_CHAT_TOOL_CHOICE_REQUIRED) {
// Must have at least one tool call
if (inputs.parallel_tool_calls) { if (inputs.parallel_tool_calls) {
// Multiple tool calls allowed
return p.choice({ content_and_tools, tools_only }) + p.end(); return p.choice({ content_and_tools, tools_only }) + p.end();
} else { } else {
// Single tool call only
return p.choice({ content_until_tool + tool_choice, tools_only }) + p.end(); return p.choice({ content_until_tool + tool_choice, tools_only }) + p.end();
} }
} else { } else {
// Tool calls are optional (auto mode)
if (inputs.parallel_tool_calls) { if (inputs.parallel_tool_calls) {
// Multiple tool calls allowed
return p.choice({ content_and_tools, content_only, tools_only }) + p.end(); 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();
} }
}); });

View File

@ -319,15 +319,15 @@ class common_peg_parser_builder {
common_peg_parser wrap(common_peg_parser_id id) { return common_peg_parser(id, *this); } 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)); } 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: public:
common_peg_parser_builder(); common_peg_parser_builder();
// Enable/disable Python dict format support (single-quoted strings). // Enable/disable Python dict format support (single-quoted strings).
// When enabled, JSON parsers will also accept Python dict-style 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; } 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_; } bool get_allow_python_dict_format() const { return allow_python_dict_format_; }
// Match nothing, always succeed. // Match nothing, always succeed.
// S -> ε // S -> ε