Setting up the model
We will start by setting up a LLama2 model and initializing our desired output format. Note that Llama2 requires approval for access to the models.HuggingFace baseline
First, let’s establish a qualitative baseline by checking the output of the model without structured decoding.JSONFormer LLM wrapper
Let’s try that again, now providing the Action input’s JSON Schema to the model.Batch processing
LMFormatEnforcer also works in batch mode:Regular expressions
LMFormatEnforcer has an additional mode, which uses regular expressions to filter the output. Note that it uses interegular under the hood, therefore it does not support 100% of the regex capabilities.Connect these docs to Claude, VSCode, and more via MCP for real-time answers.