LLM output as typed JSON objects
Typed Completion for LLMs
Use TypeScript definitions to specify LLM output types. Return structured JSON for any prompt.
- Structured JSON output in a single API call.
- Consume structured JSON that's easy to parse and use in your application instead of complex natural language responses from LLMs.
- Complex types without the hassle
- Use easy-to-understand TypeScript definitions. No need to learn JSON Schema, OpenAPI, or some other configuration's type system.
type Message = {
to: string
from: string
subject: string
body: MessageContent
}
type MessageContent = {
text: string
}
Prompt
Write an email from alice@gmail.com to bob@gmail.com to ask bob to meet for coffee.
{
"to": "bob@gmail.com",
"from": "alice@gmail.com",
"subject": "Meeting for Coffee",
"body": {
"text": "Hi Bob, would you like to meet for coffee sometime?"
}
}
Regex Pattern
T[a-z]+
H[a-z]+
I[a-z]+
G[a-z]+
G[a-z]+
L[a-z]+
E[a-z]+
Prompt
Thiggle, the company that makes LLMs useful through structured APIs, is an acronym for:
Result
Thiggle Helpful Intelligent Gathering Gadget Labs Est
Constrain LLMs with Regex Patterns or Context-Free Grammars
Regex Completion for LLMs
Use Regex or Context-Free Grammars to constrain LLMs into generating structured output. Outputs always match the specified pattern.