Skip to content

[Serving] Add Structural-Tag api to RequestResponseFormat #3187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Irfnfnkemed
Copy link

This PR adds Structural-Tag api to RequestResponseFormat, which can be used to standarlize function calling format.
It made following changes:

  • Upgrade xgrammar to latest version
  • Add Structural-Tag-relevant attributes to RequestResponseFormat and modify corresponding process
  • Add test script for Structural-Tag (passed on Llama-2-7b-chat-hf-q0f16-MLC and Llama-3-8B-Instruct-q4f16_1-MLC)

Irfnfnkemed and others added 7 commits March 14, 2025 12:22
- upgrade xgrammar calling to latest API
…mmar

- ensure the tool function will be called in expected format using xgrammar
- modify RequestResponseFormat: add structural tag according to the tools when building response format
- the tool function calling is now constrained by format: <function=function_name>parameters</function>
- tools call list will be parsed according to the calling format when processing the response
- also expose the Structural Tag api of xgrammar to RequestResponseFormat
- Expose Structural-Tag api, which can be used to standarlize function calling format
- Add test script for Structural-Tag (passed on Llama-2-7b-chat-hf-q0f16-MLC and Llama-3-8B-Instruct-q4f16_1-MLC)
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