[LLM-jp-4] parser for harmony output with a space after special tokens
LLM-jp-4.1 (https://huggingface.co/llm-jp/llm-jp-4.1-8b-thinking-gguf, also 32b-a3b and 33b) uses the gpt-oss harmony format, but its tokenizer decodes a space after every special token:
<|channel|> analysis<|message|> The user asks ...<|end|><|start|> assistant<|channel|> final<|message|> 日本の首都は東京です。The harmony parser does not recognize <|channel|> analysis as a header, so everything ends up in content and tool calls are not detected. LLM-jp-4.1 also separates parallel tool calls with <|end|> instead of ending each with <|call|>. So these models cannot be used with thinking or tools in Ollama.
Proposal
A llm-jp-4 parser under model/parsers/, used with PARSER llm-jp-4 in a Modelfile. It drops one space after each special token, passes the text to the exported harmony.HarmonyParser, and completes a tool call at every <|end|>. The harmony package is not modified.
Implementation with tests: https://github.com/llm-jp/ollama/pull/1
Checked on Linux/CUDA with the 8B GGUF: reasoning/content split, single and parallel tool calls, tool result continuation.
llama.cpp handles this format upstream since https://github.com/ggml-org/llama.cpp/pull/29681, but Ollama parses llama-server's raw output with its own parsers, so it needs its own.
I can open the PR if this is acceptable.
Source: ollama/ollama