Skip to content

Add chat template kwargs to chat completions - #1009

Draft
jennyf19 wants to merge 5 commits into
microsoft:mainfrom
jennyf19:feature/chat-template-kwargs
Draft

Add chat template kwargs to chat completions#1009
jennyf19 wants to merge 5 commits into
microsoft:mainfrom
jennyf19:feature/chat-template-kwargs

Conversation

@jennyf19

@jennyf19 jennyf19 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • add typed chat_template_kwargs to the OpenAI-compatible chat completions request
  • preserve booleans, strings, numbers, and nested JSON through request conversion
  • route template kwargs through text, media, and continued-turn prompt rendering
  • invalidate cached generators when per-turn template controls change
  • reject non-object kwargs at request deserialization

Dependencies

This draft depends on:

  1. Add chat template kwargs to C API onnxruntime-extensions#1102
  2. Add chat template kwargs to tokenizer API onnxruntime-genai#2421

No personal-fork dependency pins are present in this PR. Keep this PR draft until both upstream APIs merge and Foundry updates its normal ORT GenAI package version.

Motivation

Qwen 3's bundled chat template defaults to reasoning. Without enable_thinking:false, bounded requests can consume their entire completion budget inside <think> and never produce an answer or tool call. Qwen 2.5 does not have this reasoning-template branch.

This enables clients to send:

{
  "chat_template_kwargs": {
    "enable_thinking": false
  }
}

Related: #808

Validation

A disposable fork workflow built the complete stack—ORT Extensions #1102, ORT GenAI #2421, and this branch—without changing production dependency pins. The affected Foundry C++ unit suites passed:
https://github.com/jennyf19/foundry-local/actions/runs/32079437566

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the MSFT-AIP Team on Vercel.

A member of the Team first needs to authorize it.

Jenny Ferries added 5 commits August 18, 2026 09:05
Preserve typed JSON values from the OpenAI-compatible request through text, media, and continued-turn prompt rendering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a9f5bae1-1b88-4311-8fac-6224769e0400
Build the dependency stack only inside Jenny's fork and run the affected Foundry C++ unit suites without changing production dependency pins.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a9f5bae1-1b88-4311-8fac-6224769e0400
Foundry's manifest pins an older baseline, so the disposable workflow must retain version-history commits and install Ninja explicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a9f5bae1-1b88-4311-8fac-6224769e0400
The dependency stack compiled and affected Foundry unit suites passed in fork run 32079437566.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a9f5bae1-1b88-4311-8fac-6224769e0400
Run the stacked native build and affected Foundry tests after rebasing onto the shared preprocessing architecture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a9f5bae1-1b88-4311-8fac-6224769e0400
@jennyf19
jennyf19 force-pushed the feature/chat-template-kwargs branch from 883bebe to 1a9ac05 Compare August 18, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant