Tutorial #5: Strict JSON LLM Framework - Get LLM to output JSON exactly the way you want it!
I'm creating a framework that can generate the output of an LLM as a JSON, and ensures that all output fields are generated. This is done using iterative prompting of the error messages to the LLM should the LLM generate the output incorrectly.
Features:
- Free-text generation for output fields
- Constrained generation from one element of the list
- Constrained generation of the label from "label:description" elements of a list
- Flexible header/value generation using angle brackets
- Chain of thought prompting by ordering the output fields of the JSON
- Multiple input processing using a list as input and outputting a list of JSON
Future work:
- LLM + Rules-based Adaptive Functions
Dynamic Tool Use
Agents with Tool Use
This should be incorporated into SymbolicAI shortly too!
~~~~~~~~~~~~~~~~~~~~~~
Github Repo Link: https://github.com/tanchongmin/strictjson
~~~~~~~~~~~~~~~~~~~~~~
0:00 Introduction
1:48 Overall Open-ended Generation
3:35 List-based constraining of output
6:06 List-based label constraining of ouput
8:06 Dynamic output format with angle brackets
10:18 Chain-of-thought prompting via JSON
15:05 List Input for Multiple Processing
18:55 The Magic Revealed: How it works
~~~~~~~~~~~~~~~~~~~~~~~
AI and ML enthusiast. Likes to think about the essences behind breakthroughs of AI and explain it in a simple and relatable way. Also, I am an avid game creator.
Discord: https://discord.gg/bzp87AHJy5
LinkedIn: https://www.linkedin.com/in/chong-min-tan-94652288/
Online AI blog: https://delvingintotech.wordpress.com/
Twitter: https://twitter.com/johntanchongmin
Try out my games here: https://simmer.io/@chongmin