Running the solution produces a summary such as:
The website discusses the changing landscape of software development ...
Trying test case number two gives:
The website introduces AI Hero, and it emphasizes my experience as a member of the XState core team...
Looking at the prompt, the background data is wrapped in XML tags. There is a <url> tag and a <content> tag. The <content> tag is especially important because the raw content may include markdown formatting. Having a clear start and end tag lets the LLM know exactly where the content begins and ends. Without this, the raw content could throw it off.
The rules included here are:
The prompt also passes in the conversation history and adds an output format section: return only the summary.
This approach shows how to handle adding retrieved data into your prompts. With multiple websites, you could even consider wrapping them in a <website> tag or moving the URL inside the website tag <website url="${url}">.
XML makes the structure expressive and explicit, clearly marking the boundaries.
<url>${url}</url><content>${rawContent}</content>
<rules>- Use the content of the website to answer the question.- If the question is not related to the content of the website, say "I'm sorry, I can only answer questions about the content of the website."- Use quotes from the content of the website to answer the question.- Use paragraphs in your output.</rules>