Getting GPT to generate correct XML tags for node_id+keyword

Hi All,

I am building an RAG app in which I am trying to get GPT 4 to attribute each key information to a certain node_id (that it got via RAG into context), then I would wrap that into a clickable XML tag for the user. Current output is ok-ish, but still with lots of failure to generate correct tags.
Did anyone face a similar issue or came up with a solution?
Thanks!

Did you try in your System Prompt to tell it to only generate XML and no descriptive or explanatory text, and give it an example of the XML you want inside a markdown gated codeblock?

Thanks for the reply,
I tried giving it multiple instructions + examples of correct tag formatting, but did not place it within a markdown gated codeblock,
Placing within markdown helps in your experience?

Thought I would give it a shot:
Output should be formatted explicitly for XML use, focusing on generating clickable links. Avoid using Markdown syntax; instead, ensure that all outputs are in plain text tailored for XML conversion.

Re: Markdown gate code block, haven’t seen improvement other than easier to maintain and provide clarity to the LLM in a better order.

1 Like

I’ve been always using fenced code blocks for my examples because that’s just an additional tip to the LLM that it’s the XML snipped, but I never checked if it helped or not. One other tip: I’ve also mentioned “machine parsing”, as in “Make your output only XML because it needs to be parsed by machine.”

1 Like

Thanks, will try it out, I did place it in code blocks and it seems to be more consistent now

1 Like