The Slangify focus is writing DSLs in Raku. Raku is an open source programming language with built-in Grammar capability. Why Raku?.
Use rakubrew to install a Raku compiler…
…for macOS:
curl https://rakubrew.org/install-on-macos.sh | sh
…for linux:
curl https://rakubrew.org/install-on-perl.sh | sh
See https://raku.org/install for more options.
Raku comes complete with the zef package manager.
git clone https://github.com/librasteve/Slangify-Tutorial
cd Slangify-Tutorial
zef install --/test .
This will bring in all the dependencies - such as the LLM::Functions module.
LLM::Functions picks up your key from the environment:
export OPENAI_API_KEY=sk-...
See https://raku.land/zef:antononcube/LLM::Functions for other supported LLMs.
You can append the export cmd to your ~/.zshrc or ~/.bashrc.
extract-booking "Jane Murphy booked a table for 4 at 7:30pm tomorrow at Bistro Verde"
You should see a JSON string with name, party, time, restaurant, and date fields.