Dify 101
Categories
Extract XML Content from Claude
You may like to use the Prompt Generator of Claude Console, and Claude is good at using XML tags to assist and standardize the output content. At this time, you can use this code node and place it after the LLM Node to extract the content in the specific XML Tag.
You may like to use the Prompt Generator of Claude Console, and Claude is good at using XML tags to assist and standardize the output content. At this time, you can use this code node and place it after the LLM Node to extract the content in the specific XML Tag.
def main(arg1: str) -> dict:
start_tag = "<off_topic_response>"
end_tag = "</off_topic_response>"
start_index = arg1.index(start_tag) + len(start_tag)
end_index = arg1.index(end_tag)
content = arg1[start_index:end_index].strip()
return {"result": content}
👉 Claude Prompt Generator: https://console.anthropic.com/dashboard
def main(arg1: str) -> dict:
start_tag = "<off_topic_response>"
end_tag = "</off_topic_response>"
start_index = arg1.index(start_tag) + len(start_tag)
end_index = arg1.index(end_tag)
content = arg1[start_index:end_index].strip()
return {"result": content}
👉 Claude Prompt Generator: https://console.anthropic.com/dashboard
Sponsor
Related Tutorial
🍃 Nothing Here Now ~
🍃 Nothing Here Now ~
🍃 Nothing Here Now ~
Subscribe to our newsletter 🤩
We regularly list new indie products & makers. Get them in your inbox!
We regularly list new indie products & makers. Get them in your inbox!
We regularly list new indie products & makers. Get them in your inbox!