FastChat icon indicating copy to clipboard operation
FastChat copied to clipboard

support more LaTeX delimiters

Open kai01ai opened this issue 1 year ago • 2 comments

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.sh to 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).

kai01ai avatar May 15 '24 09:05 kai01ai

Ready for review!

Before this patch: image After this patch: image

kai01ai avatar May 20 '24 04:05 kai01ai

cc @lisadunlap

kai01ai avatar May 20 '24 04:05 kai01ai