jinja : add missing 'in' test to template engine (#19004)#19239
Merged
ngxson merged 2 commits intoggml-org:masterfrom Feb 2, 2026
Merged
jinja : add missing 'in' test to template engine (#19004)#19239ngxson merged 2 commits intoggml-org:masterfrom
ngxson merged 2 commits intoggml-org:masterfrom
Conversation
The jinja template parser was missing the 'in' test from
global_builtins(), causing templates using reject("in", ...),
select("in", ...), or 'x is in(y)' to fail with
"selectattr: unknown test 'in'".
This broke tool-calling for Qwen3-Coder and any other model
whose chat template uses the 'in' test.
Added test_is_in supporting array, string, and object containment
checks, mirroring the existing 'in' operator logic in runtime.cpp.
Includes test cases for all three containment types plus
reject/select filter usage.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
This PR appears to contain AI-generated code without proper disclosure or watermarking. Per our contribution guidelines, we cannot accept it in its current form. |
Contributor
Author
Thank you for flagging - just updated the PR description. Sincere apologies for the oversight - genuinely did not mean to mislead. |
ngxson
approved these changes
Feb 2, 2026
shaofeiqi
pushed a commit
to qualcomm/llama.cpp
that referenced
this pull request
Feb 6, 2026
…ml-org#19239) * jinja : add missing 'in' test to template engine (ggml-org#19004) The jinja template parser was missing the 'in' test from global_builtins(), causing templates using reject("in", ...), select("in", ...), or 'x is in(y)' to fail with "selectattr: unknown test 'in'". This broke tool-calling for Qwen3-Coder and any other model whose chat template uses the 'in' test. Added test_is_in supporting array, string, and object containment checks, mirroring the existing 'in' operator logic in runtime.cpp. Includes test cases for all three containment types plus reject/select filter usage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * reuse test_is_in in binary op --------- Co-authored-by: Sid Mohan <sidmohan0@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
liparetejas
pushed a commit
to liparetejas/llama.cpp
that referenced
this pull request
Feb 23, 2026
…ml-org#19239) * jinja : add missing 'in' test to template engine (ggml-org#19004) The jinja template parser was missing the 'in' test from global_builtins(), causing templates using reject("in", ...), select("in", ...), or 'x is in(y)' to fail with "selectattr: unknown test 'in'". This broke tool-calling for Qwen3-Coder and any other model whose chat template uses the 'in' test. Added test_is_in supporting array, string, and object containment checks, mirroring the existing 'in' operator logic in runtime.cpp. Includes test cases for all three containment types plus reject/select filter usage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * reuse test_is_in in binary op --------- Co-authored-by: Sid Mohan <sidmohan0@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey all!
Note: Fixes #19004
Context:
The jinja template parser was missing the
'in'test fromglobal_builtins(), causing templates usingreject("in", ...), select("in", ...), or 'x is in(y)'to fail withselectattr: unknown test 'in'This broke tool-calling for Qwen3-Coder and would break for any other model whose chat template uses the
intest.What I did:
test_is_insupporting array, string, and object containment checks, mirroring the existing 'in' operator logic in runtime.cpp.Local Test environment:
Comments:
AI Disclosure
Built with Claude (AI-assisted). Fully tested locally. I understand what the code does.
Appreciate the look - let me know if you have any questions!