- 
          
- 
        Couldn't load subscription status. 
- Fork 10.9k
[Misc] Fix chat input string in xgrammar format #16239
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
Conversation
| 👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run  Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add  🚀 | 
Signed-off-by: lvfei.lv <[email protected]>
061cf96    to
    0f2e045      
    Compare
  
    | Hello, @Isotr0py, can you help me to review this pull request ? I think the failure of CI is not caused by my code. Thank you very much! | 
| I'm not familiar with structured-outputs, perhaps @russellb can take a look to this xgrammar related PR? | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To deal with the stream of \n, change your --guided-decoding-backend to xgrammar:disable-any-whitespace
| "const": "celsius" | ||
| }, { | ||
| "const": "fahrenheit" | ||
| }] | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| If you still have a problem given my feedback above, please feel free to reopen this, or we can talk in #feat-structured-output on slack. Thank you! | 
No related Issue, just fix chat input string in xgrammar format
If I launch an api server as follow:
If I send a chat request as follow:
I will receive response
{"object":"error","message":"The provided JSON schema contains features not supported by xgrammar.","type":"BadRequestError","param":null,"code":400}After modifying the input content as below:
I will receive response
{"id":"chatcmpl-730d806c0eeb4a058b4892a51d8c740f","object":"chat.completion","created":1744094949,"model":"mistralai/Mistral-7B-Instruct-v0.3","choices":[{"index":0,"message":{"role":"assistant","reasoning_content":null,"content":"","tool_calls":[{"id":"chatcmpl-tool-e505d4794688402f9fda7f1685adc933","type":"function","function":{"name":"get_current_weather","arguments":"{\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}}]},"logprobs":null,"finish_reason":"length","stop_reason":null}],"usage":{"prompt_tokens":188,"total_tokens":288,"completion_tokens":100,"prompt_tokens_details":null},"prompt_logprobs":null}