ianb / llm-garden

A number of experiments using GPT-3, delivered in a web app
https://llm.ianbicking.org
48 stars 8 forks source link

Implement LaTex rendering in chat #87

Open ianb opened 1 year ago

ianb commented 1 year ago

For some educational purposes especially it would be nice to render LaTeX.

I think this site makes it easy to render: https://uechi.io/blog/math-api/ (just link to an image with the latex in a query parameter).

We either have to induce the chatbot to produce recognizable LaTeX, or we have to identify equations and translate them to LaTeX in a second request. Probably easier to get it to produce the code. We might detect it using a regex (the leading backslashes make it easier) or encourage GPT to use some markup (for some reason it chose $$equation$$ itself)

Probably the whole thing could be a flag to <Markdown> to enable

ianb commented 1 year ago

Having tried it a little, I'm worried the prompt encourages it to produce equations when it shouldn't. We don't want it to come out the gate offering fancy equations. Also it's hard to talk about equations when there's something like ΔT which can't be easily typed (and since it's in an image, can't be copied).