We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8101d4e commit 2ff21c4Copy full SHA for 2ff21c4
1 file changed
examples/outputs/json/main.go
@@ -0,0 +1,30 @@
1
+package main
2
+
3
+import (
4
+ "fmt"
5
6
+ "github.com/bit8bytes/gogantic/outputs/json"
7
+)
8
9
+type joke struct {
10
+ Setup string `json:"setup"`
11
+ Punchline string `json:"punchline"`
12
+}
13
14
+func main() {
15
+ parser := json.NewParser[joke]()
16
+ joke, err := parser.Parse(`
17
+ {
18
+ "setup": "Why don't scientists trust atoms?",
19
+ "punchline": "Because they make up everything!"
20
+ }`)
21
+ if err != nil {
22
+ panic(err)
23
+ }
24
25
+ fmt.Println("Setup: " + joke.Setup)
26
+ fmt.Println("Punchline: " + joke.Punchline)
27
28
+ instructions := parser.Instructions()
29
+ fmt.Println("LLM instructions: " + instructions)
30
0 commit comments