Comment by simonw

1 year ago

Bits of this tutorial feel a little bit out-dated. The appendix on function calling for example - https://github.com/anthropics/courses/blob/master/prompt_eng... - shows how to implement function calling from scratch using XML-style tags - but Claude's API has had JSON schema-based function calling for a few months now: https://docs.anthropic.com/en/docs/build-with-claude/tool-us...

Oh, never mind - they have an entire separate course about tool use via the API here: https://github.com/anthropics/courses/blob/master/tool_use/0...

So they're using tools in that appendix purely to demonstrate how sophisticated you can get with raw prompting.

The documentation still advocates using XML tags as a subset of prompt engineering despite the push for JSON-based structured I/O, confusingly: https://docs.anthropic.com/en/docs/build-with-claude/prompt-...

The structured output tutorial uses the XML tags to wrap user input instead of using system prompt engineering and then passing the user input as-is (IMO system prompt engineering is still better since it adds more control levers): https://github.com/anthropics/courses/blob/master/tool_use/0...

I saw a talk recently from one of their prompt engineers where he encouraged XML-style tag use as well. Supported by the training datasets they use.

  • Was this in person or do you have a link by any chance? Would love to see it.

    From my own experience XML tags are incredibly powerful — particularly for very large system prompts, with some markdown in there too.