• Stefy Lanza (nextime / spora )'s avatar
    parser: repair gemma-4's corrupted tool-call tokens (<|"|> quotes, bad markers) · 5135f8f8
    Stefy Lanza (nextime / spora ) authored
    gemma-4 GGUF finetunes emit a corrupted tool-call scheme that broke both
    extraction and display, e.g.:
      <|tool_call>call:bash{command:<|"|>wc -l README.md<|"|>}<tool_call|><|tool_response>…
    
    Three distinct corruptions, all now handled by normalize_gemma_tool_tokens():
    - <|"|>  is the model's stand-in for a " quote — it leaked verbatim into string
      args, so a bash command became <|"|>wc -l<|"|> and failed with
      "syntax error near unexpected token |". Restored to a real ".
    - malformed open/close markers <|tool_call> / <tool_call|> (vs the canonical
      <|tool_call|>) — stripped, so the native call:NAME{…} body parses and the
      markers don't leak as text. The canonical <|tool_call|> / <|tool_call_end|>
      are deliberately left intact so Phi-style parsing is unaffected.
    - a hallucinated <|tool_response>…/<turn|> tail (the model fakes the tool result)
      — stripped, and strip_tool_calls_from_content now also drops response:NAME{…}
      spans so the fake result never reaches the user or gets executed.
    
    Wired into ModelParserAdapter + ToolCallParser (extract & strip) and
    cleanup_control_tokens, covering the streaming, non-streaming and fallback paths.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_011DDv7BchtZQWsnPG6Jm49m
    5135f8f8
Name
Last commit
Last update
codai Loading commit data...
docs Loading commit data...
packaging Loading commit data...
samples Loading commit data...
tests Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
AI.PROMPT Loading commit data...
CODERAI_API_DOCUMENTATION.md Loading commit data...
CoderAI.gif Loading commit data...
DISTRIBUTION.md Loading commit data...
LICENSE.md Loading commit data...
MULTIMODAL_CAPABILITIES.md Loading commit data...
MULTIMODAL_UI_EXAMPLES.md Loading commit data...
README.md Loading commit data...
build-oci.sh Loading commit data...
build.ps1 Loading commit data...
build.sh Loading commit data...
coderai Loading commit data...
coderai-broker-implementation-reference.md Loading commit data...
coderai-integration.md Loading commit data...
commands Loading commit data...
osxbuild.sh Loading commit data...
package-oci.sh Loading commit data...
package-tarball.sh Loading commit data...
requirements-nvidia.txt Loading commit data...
requirements-vulkan.txt Loading commit data...
requirements.txt Loading commit data...
run-oci.sh Loading commit data...
smoke-test-oci.sh Loading commit data...
todo.md Loading commit data...
video_editor.config.json Loading commit data...