Instructions to use onnx-community/gemma-4-E2B-it-ONNX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use onnx-community/gemma-4-E2B-it-ONNX with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('any-to-any', 'onnx-community/gemma-4-E2B-it-ONNX');
Fix chat template crash when tool property has no explicit type
Bug
chat_template.jinja calls value['type'] | upper on every property in a tool'sparameters.properties, in four places inside the format_parameters macro.
JSON Schema (and the OpenAI Chat Completions API) both allow a property without an
explicit type field — a property with only a description is valid. Several popular
OpenAI-compatible clients emit schemas like that (for example, agent frameworks such
as Hermes and OpenClaw).
When such a schema is passed through Gemma's chat template, Jinja raises:
Cannot apply filter "upper" to type: UndefinedValue
and generation fails before any tokens are produced.
Minimal repro
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "onnx-community/gemma-4-E4B-it-ONNX",
"messages": [{"role":"user","content":"hi"}],
"tools": [{"type":"function","function":{"name":"test","parameters":{
"type":"object","properties":{"a":{"description":"a value"}}
}}}],
"max_tokens": 10
}'
(Reproduced against transformers.js inference; the same template is loaded by@huggingface/transformers under Node.)
Fix
Default the missing type to 'string' before applying | upper. String is the most
common and safest default for a described but untyped property. Same fix pattern, four
call sites:
- value['type'] | upper
+ (value['type'] | default('string')) | upper
This does not change behavior for any property that already sets type.
Scope
- Only touches
format_parametersinchat_template.jinja. - Same fix applies to
onnx-community/gemma-4-E2B-it-ONNX(identical template) — a
companion PR is opened there.