TikZ (Latex Output GPT4o and lower)

Good day all. I have an issue generating LateX code (And in particular Tikz)

I think it used to work but I am not entirely sure. I have a task now that requires output in TikZ (And extension to LateX)

The thing is, it outputs the right part of the expressions, it seems.

For instance, this is what the GPT API generates.(any model)



When I ask for the equivalent in Gemini pro1.5 I get the proper TikZ code



Same client. So it’s not that.

Does anyone have the same experience generating TikZ…It works flawlessly in ChatGPT…but not through the API.

Thank you!

I did add in-context examples but it somehow just does not want to generate the code, which kind of makes me wonder if it’s not a big in the API, that it cuts off ‘escaped words’ Because LateX starts with \thing