Skip to content

Instantly share code, notes, and snippets.

View anthoturc's full-sized avatar

Anthony Turcios anthoturc

View GitHub Profile
@garg-aayush
garg-aayush / qwen35-chat-template-corrected.jinja
Created March 28, 2026 18:30
Corrected Qwen3.5 chat template for llama.cpp - fixes system message ordering for agentic tools like OpenCode and Codex
{%- set image_count = namespace(value=0) %}
{%- set video_count = namespace(value=0) %}
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
{%- if content is string %}
{{- content }}
{%- elif content is iterable and content is not mapping %}
{%- for item in content %}
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
{%- if is_system_content %}
{{- raise_exception('System message cannot contain images.') }}