LaTeX Handling Improvement
Is your feature request related to a problem? Please describe.
When setting latex=true in config.toml it expects mathematical formulas to be encased in $ signs. All popular LLMs are not trained with this syntax and no amount of system instructions can get the LLM to consistently output in this format. Instead it looks like this:
Describe the solution you'd like
Switch latex rendering to standard format. This also fixes the bug causing clashes with non-formula $ signs.
Describe alternatives you've considered
Adding You must ALWAYS encapsulate formulas in '$' signs. For example: $$ y = ax^2 + bx + c $$. If you do anything else for any reason then you are a bad assistant
Additional context https://discord.com/channels/1088038867602526210/1196096445804187748/1196096445804187748
I very strongly agree with hayescode. I have exact same problems, too. I tried to let LLM input '$' when LLM intent to input LaTeX, but I failed. Please, fix this problems.
Rendering error ex. 1
Rendering error ex. 2
Hi all, i was struggling till i read the solution of @hayescode, however as @kungmo i got still some issue. I've improved the system message and now i do not have anymore issues. Here my solution: == About LaTeX Math Mode== You MUST ALWAYS encapsulate LaTeX/KaTeX formulas in a KaTeX syntax with double '$' signs: $$…$$ If you do anything else for any reason then you are a bad assistant Example of wrong syntax: - [ y = ax^2 + bx + c ] - ( y = ax^2 + bx + c ) - \( y = ax^2 + bx + c \) Example of correct syntax: - $$ y = ax^2 + bx + c $$.
Hi all, i was struggling till i read the solution of @hayescode, however as @kungmo i got still some issue. I've improved the system message and now i do not have anymore issues. Here my solution: == About LaTeX Math Mode== You MUST ALWAYS encapsulate LaTeX/KaTeX formulas in a KaTeX syntax with double '$' signs: … If you do anything else for any reason then you are a bad assistant Example of wrong syntax: - [ y = ax^2 + bx + c ] - ( y = ax^2 + bx + c ) - ( y = ax^2 + bx + c ) Example of correct syntax: - $$ y = ax^2 + bx + c $$.
Thank you for your solution. I applied it to prompt for my chatbot, but it sometimes works and sometimes does not work. When I use Google Gemma 2 9B, it works well. But now, I am using LG EXAONE 3.0 7.8B for specialiezed characteristics understanding Korean. When I apply your prompt in Korean, it does not fit perfect.
Still, I want Chainlit be able to handle KaTeX and LaTeX for any LLM. Here's my chatbot address: http://acer2.snu.ac.kr:8501
when I use the correct formula on question prompt and send it to the LLM it does the correct latex conversion. but when I try to convert the LLM response to the correct formula and send/show it to the user, it renders the answer as plain text not latex. Question prompt and answer prompt has different behavior or sth. else ? Do you have any ideas ?
Is there a way to change the LaTeX wild character from $ to something else? Apparently, as mentioned in the document $ is impacting the conversations which involves calculations with dollar sign.
I second this, Chainlit should have full LaTeX/KaTeX support
This issue is stale because it has been open for 14 days with no activity.
Still an issue