Slangify-Tutorial
Slangify-Tutorial
← Index
00. Slangify::Tutorial
Using DSLs with LLMs: From Prompt to Structured Output
Suppose you want an LLM to extract structured information from messy text — but you don’t want to hand-write JSON schemas or fragile parsing logic.
Input:
Jane booked a table for 4 at 7:30pm tomorrow at Bistro Verde
Desired output:
"name": "Jane",<br>"party_size": 4,<br>"time": "7:30 PM",<br>"restaurant": "Bistro Verde",<br>"date": "tomorrow"
Slangify lets you define that structure with a DSL, then use an LLM to populate it reliably. This tutorial walks through everything from a first schema to a real-world pipeline.
What you will learn
Understand what Slangify does
Define a simple DSL schema using a Raku Grammar
Connect it to an LLM via LLM::Functions
Generate structured outputs from prompts
Validate and post-process results
See how this fits into a real workflow
Chapters
01. Setup
02. Your First Schema
03. Connecting to an LLM
04. The Generated Output
05. Iteration
06. Validation and Constraints
07. Prompt Engineering Patterns
08. Prompts
09. A Real-World Example
10. Common Pitfalls
11. Next Steps
Prompt Guide
Naturally, the example DSL code shown in this tutorial was itself generated by an LLM Agent (Claude Code). See LINK HERE for the prompts and tweaks we used to get a clean solution - adapt those for your own project.
More Info
Visit https://slangify.org for more information, examples and guidance.
Please ping the https://raku.org/community
This site is open source. Improve this page.