Commit Graph

10 Commits

Author SHA1 Message Date
code4me2 0b7d8eda68 harmony: handle embedded analysis segments in tool call JSON
Models using the harmony parser may output analysis/thinking segments
before JSON arguments in tool calls. For example:

  <|channel|>analysis<|message|>I need to list files.{"path": "/tmp"}

Previously this would fail JSON parsing. Now the parser:
- Extracts and strips harmony analysis segments before JSON
- Preserves the thinking content separately
- Uses brace-matching to extract complete JSON objects

This brings the harmony parser in line with Qwen3VL and Cogito parsers
which already handle mixed thinking/tool call content via event-based
parsing.
2025-12-24 22:08:22 -08:00
Grace d70e935526
Parser for Cogito v2 (#13145) 2025-11-19 17:21:07 -08:00
Devon Rifkin fd88cd7cb0 harmony: don't sanitize built-ins
In #11910 we started sanitizing function names, but we accidentally were
modifying built-ins like `browser.open` to `browser_open`. This was
removing the special prompt rendering for built-ins, but this wasn't
immediately apparent since the models seem to be reasonably good at
remembering the built-ins even when presented with these slightly
renamed version. This fix prevents built-ins from ever being renamed.
2025-09-23 23:34:55 -07:00
Devon Rifkin e7f56ef3d8 harmony: remove special casing in routes.go
Now that we have a built-in parser abstraction, which was introduced in
<https://github.com/ollama/ollama/pull/12248>, we can modify our harmony
parser to match this and then get rid of nearly all of the
harmony-specific logic in routes.go. We do have a small amount of
code that turns the parser on by default if the architecture matches and
no other built-in parser was provided.

The built-in parser interface was modified in order to handle harmony's
prefill and tool name translation requirements.
2025-09-18 14:55:59 -07:00
jmorganca 92b96d54ef Revert "runner: move harmony to runner (#12052)"
This reverts commit 1a558f98e2.
2025-09-12 20:40:14 -03:00
jmorganca 9d56e63dbf Revert "runner: simplify parser entrypoints in runner (#12233)"
This reverts commit 8d6fffaead.
2025-09-12 20:40:14 -03:00
Parth Sareen 8d6fffaead
runner: simplify parser entrypoints in runner (#12233) 2025-09-10 11:24:42 -07:00
Parth Sareen 1a558f98e2
runner: move harmony to runner (#12052) 2025-09-08 15:07:59 -07:00
Michael Yang fb92b61754
logutil: add Trace and TraceContext helpers (#12110) 2025-09-02 13:09:12 -07:00
Parth Sareen 7cce5aac76
harmony: move harmony parsing into a package (#12016) 2025-08-21 13:56:22 -07:00