ollama/model
Devon Rifkin 40a1317dfd
gemma4: update renderer to match new jinja template (#15490)
* gemma4: update renderer to match new jinja template

Google has updated their jinja template for gemma4, and so this change
gives us parity with the new template. The parsing also slightly changed
upstream, so we make a small change to our parser as well.

I've also corrected a few probably existing edge cases, especially
around type unions. The upstream output format is weird (a stringified
array), but in practice the models seem to understand it well.

* gemma4: special case simple `AnyOf`s

The upstream template doesn't handle `AnyOf`s, but since in the previous
commit we saw type unions work reasonably well, I'm now treating very
simple `AnyOf`s as type unions to help in cases where they might be used

* fix lint

* gemma4: prefer empty instead of `None`

We can't currently distinguish between a result being not-present vs.
empty. The empty case seems more important (e.g., a legitimately empty
tool call)

* gemma4: be more careful for tool results with missing IDs
2026-04-10 15:45:27 -07:00
..
imageproc deepseekocr 2025-11-18 16:11:37 -08:00
input batch: use tensors for outputs (#12185) 2025-09-15 14:33:06 -07:00
models tokenizer: add byte fallback for SentencePiece BPE encoding (#15232) 2026-04-02 13:04:45 -07:00
parsers gemma4: update renderer to match new jinja template (#15490) 2026-04-10 15:45:27 -07:00
renderers gemma4: update renderer to match new jinja template (#15490) 2026-04-10 15:45:27 -07:00
model.go Add support for gemma4 (#15214) 2026-04-02 11:33:33 -07:00
model_test.go Add support for gemma4 (#15214) 2026-04-02 11:33:33 -07:00