From 3c75eed8106a50f3d56cb7db4c85f15e2b6b8803 Mon Sep 17 00:00:00 2001 From: Sayan Shaw Date: Tue, 12 May 2026 14:29:44 -0700 Subject: [PATCH 1/5] Support Harmony/GPT-OSS tool calling: update ort-extensions, add tools-only path to model-qa.py --- cmake/deps.txt | 2 +- examples/python/model-qa.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/deps.txt b/cmake/deps.txt index 35e3637690..fc594a0a11 100644 --- a/cmake/deps.txt +++ b/cmake/deps.txt @@ -14,7 +14,7 @@ pybind11;https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.zip;f78029 googletest;https://github.com/google/googletest/archive/530d5c8c84abd2a46f38583ee817743c9b3a42b4.zip;5e3a61db2aa975cfd0f97ba92c818744e7fa7034 microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.zip;e4a542a323c070376f7c2d1973d0f7ddbc1d2fa5 directx_headers;https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.613.1.zip;47653509a3371eabb156360f42faf582f314bf2e -onnxruntime_extensions;https://github.com/microsoft/onnxruntime-extensions.git;7b9699c1cc580f1a31bc0d59a90b9a3f22567d17 +onnxruntime_extensions;https://github.com/microsoft/onnxruntime-extensions.git;2fea97118c05d878c08c99a0bd0006cee2715605 # These two dependencies are for the optional constrained decoding feature (USE_GUIDANCE) llguidance;https://github.com/microsoft/llguidance.git;94fa39128ef184ffeda33845f6d333f332a34b4d diff --git a/examples/python/model-qa.py b/examples/python/model-qa.py index 3d711efc79..a8e50d2389 100644 --- a/examples/python/model-qa.py +++ b/examples/python/model-qa.py @@ -60,6 +60,13 @@ def main(args): tool_call_end=args.tool_call_end, ) input_list[0]["tools"] = tools + elif args.tools_file: + # Tools provided without constrained decoding (e.g. Harmony/GPT-OSS models + # that handle tool calling natively via their chat template). + # Tools are passed as a separate parameter to apply_chat_template, + # NOT embedded in messages (that's the Phi-4 constrained decoding path). + with open(args.tools_file, 'r') as f: + tools = json.dumps(json.load(f)) # Keep track of timings if requested if args.timings: From 58f64ec5e218d02f6ac98f4e78eeecd9962b22de Mon Sep 17 00:00:00 2001 From: Sayan Shaw Date: Tue, 9 Jun 2026 11:46:22 -0700 Subject: [PATCH 2/5] update to newer ext commit with perf improvements --- cmake/deps.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/deps.txt b/cmake/deps.txt index 947d24aa16..de6f23b92c 100644 --- a/cmake/deps.txt +++ b/cmake/deps.txt @@ -14,7 +14,7 @@ pybind11;https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.zip;f78029 googletest;https://github.com/google/googletest/archive/530d5c8c84abd2a46f38583ee817743c9b3a42b4.zip;5e3a61db2aa975cfd0f97ba92c818744e7fa7034 microsoft_wil;https://github.com/microsoft/wil/archive/refs/tags/v1.0.230629.1.zip;e4a542a323c070376f7c2d1973d0f7ddbc1d2fa5 directx_headers;https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.613.1.zip;47653509a3371eabb156360f42faf582f314bf2e -onnxruntime_extensions;https://github.com/microsoft/onnxruntime-extensions.git;97809255e4cfc6fdee2b32d565935067c0309f8b +onnxruntime_extensions;https://github.com/microsoft/onnxruntime-extensions.git;05b2c1ac7d58fd31a05c9cb4f28bf04b9366c128 # These two dependencies are for the optional constrained decoding feature (USE_GUIDANCE) llguidance;https://github.com/microsoft/llguidance.git;94fa39128ef184ffeda33845f6d333f332a34b4d From 00c1f9c0ad26aeb0800273f7fbfd8c39f2968b06 Mon Sep 17 00:00:00 2001 From: Sayan Shaw Date: Tue, 9 Jun 2026 12:03:00 -0700 Subject: [PATCH 3/5] undo model-qa.py --- examples/python/model-qa.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/examples/python/model-qa.py b/examples/python/model-qa.py index becb0f6c16..479b288e99 100644 --- a/examples/python/model-qa.py +++ b/examples/python/model-qa.py @@ -1,4 +1,4 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. +# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse @@ -61,13 +61,6 @@ def main(args): tool_call_end=args.tool_call_end, ) input_list[0]["tools"] = tools - elif args.tools_file: - # Tools provided without constrained decoding (e.g. Harmony/GPT-OSS models - # that handle tool calling natively via their chat template). - # Tools are passed as a separate parameter to apply_chat_template, - # NOT embedded in messages (that's the Phi-4 constrained decoding path). - with open(args.tools_file, 'r') as f: - tools = json.dumps(json.load(f)) # Keep track of timings if requested if args.timings: From b0149a430e93fa8ab41150afd3a028cba44dd9b7 Mon Sep 17 00:00:00 2001 From: Sayan Shaw Date: Tue, 9 Jun 2026 12:04:27 -0700 Subject: [PATCH 4/5] undo model-qa.py --- examples/python/model-qa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python/model-qa.py b/examples/python/model-qa.py index 479b288e99..0502865f4d 100644 --- a/examples/python/model-qa.py +++ b/examples/python/model-qa.py @@ -178,4 +178,4 @@ def main(args): get_guidance_args(parser) args = parser.parse_args() - main(args) + main(args) \ No newline at end of file From ba3f00fb9ab742e2f3bff7b3436e10d534d65ef8 Mon Sep 17 00:00:00 2001 From: Sayan Shaw Date: Tue, 9 Jun 2026 13:48:12 -0700 Subject: [PATCH 5/5] amend --- examples/python/model-qa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/python/model-qa.py b/examples/python/model-qa.py index 0502865f4d..aed1b1f23c 100644 --- a/examples/python/model-qa.py +++ b/examples/python/model-qa.py @@ -1,4 +1,4 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. +# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse @@ -178,4 +178,4 @@ def main(args): get_guidance_args(parser) args = parser.parse_args() - main(args) \ No newline at end of file + main(args)