FastChat
FastChat copied to clipboard
support more LaTeX delimiters
Why are these changes needed?
Certain advanced models, such as GPT/Yi, have the capability to generate LaTeX formulas enclosed within \[...\], but this format is not support yet. This PR add more LaTeX delimiters for better display format in Chatbot Arena.
However, there is a bug while specific this latex_delimiters_set in stream mode, as mentioned in https://github.com/gradio-app/gradio/issues/8006, we should wait the bug fixed then test and merge this PR
Update:
Above bug will not trigger after offline deployed webui test. But there is another bug that markdown is treating \ as escape character first, so \\[ will be rendered as [ first, then it will not match LaTeX delimiters defined in latex_delimiters_set. The solution might be escape model output by replace \\[ with \\\\[ before render...
Related issue number (if applicable)
Checks
- [x] I've run
format.shto lint the changes in this PR. - [x] I've included any doc changes needed.
- [x] I've made sure the relevant tests are passing (if applicable).
Ready for review!
Before this patch:
After this patch:
cc @lisadunlap