From the course: Building with the Claude API by Anthropic

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Structure with XML tags

Structure with XML tags

The next topic we are going to examine is the idea of providing structure in your prompt by using XML tags. Now, let me give you a little bit of backstory on this. Very often, whenever we write out a prompt, we're going to interpolate some amount of content into it, and we've been doing that already. Inside of our example, we have been interpolating some height, weight, goal, and restrictions. Now, each of these values are rather small, but it's entirely possible that we might eventually write a prompt where we need to put in a lot of content into a prompt. For example, examine the prompt on the right hand side. We might decide to paste in 20 pages of sales records and try to get Cloud to analyze them in some way. Whenever we dump a lot of content into a prompt, it can be a little bit challenging for Cloud to figure out exactly what text really means what or how text is actually grouped together. One way that we can make the structure of our prompt a little bit more obvious is by…

Contents