Skip to content

Instantly share code, notes, and snippets.

@savelee
Last active June 13, 2024 09:10
Show Gist options
  • Save savelee/1a895577d179b23fae1eb5428ee1fe34 to your computer and use it in GitHub Desktop.
Save savelee/1a895577d179b23fae1eb5428ee1fe34 to your computer and use it in GitHub Desktop.
JSON Schema Prompts
Parse a customer's pizza order into valid JSON, using the following schema:
SCHEMA:
```
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"size": {
"type": "string"
},
"type": {
"type": "string"
},
"ingredients": {
"type": "array",
"items": [
{
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
},
{
"type": "string"
}
]
}
]
}
},
"required": [
"size",
"type",
"ingredients"
]
}
```
EXAMPLE:
I want a small pizza with cheese, tomato sauce, and pepperoni.
JSON Response:
```json
{
"size": "small",
"type": "normal",
"ingredients": [
[
"cheese",
"tomato sauce",
"peperoni"
]
]
}
```
EXAMPLE:
Can I get a large pizza with tomato sauce, basil and mozzarella
JSON Response:
```json
{
"size": "large",
"type": "normal",
"ingredients": [
[
"tomato sauce",
"bazel",
"mozzarella"
]
]
}
```
EXAMPLE:
Can I get a medium half-half pizza? The first half should have tomato sauce and meatballs. The other half is tomato sauce and cheese.
JSON Response:
```json
{
"size": "medium",
"type": "half-half",
"ingredients": [
[
"tomato sauce",
"meatballs"
],
[
"tomato sauce",
"cheese"
]
]
}
```
Customer Order: I want a large half-half pizza. One with cheese and mozzarella. The other part with tomato sauce, ham and pineapple. Yeah I know, that's my daughter's choice.
JSON Response:
```json
{
"size": "large",
"type": "half-half",
"ingredients": [
[
"cheese",
"mozzarella"
],
[
"tomato sauce",
"ham",
"pineapple"
]
]
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment