generated from milosgajdos/go-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
45 lines (38 loc) · 971 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"context"
"log"
"github.com/milosgajdos/go-vocode"
)
func main() {
client := vocode.NewClient()
ctx := context.Background()
createPromptReq := &vocode.CreatePromptReq{
PromptReq: vocode.PromptReq{
Content: "You are a voice assistant that answers questions about coding",
Fields: []vocode.Field{
{
Type: vocode.EmailFieldType,
Label: "Foo",
Name: "FooPrompt",
Desc: "Example prompt",
},
},
},
}
res, err := client.CreatePrompt(ctx, createPromptReq)
if err != nil {
log.Fatalf("failed creating prompt: %v", err)
}
log.Printf("created prompt: %v", res)
a, err := client.GetPrompt(ctx, res.ID)
if err != nil {
log.Fatalf("failed getting prompt %s: %v", res.ID, err)
}
log.Printf("got prompt: %v", a.ID)
prompts, err := client.ListPrompts(ctx, nil)
if err != nil {
log.Fatalf("failed listing prompts: %v", err)
}
log.Printf("got %d prompts: %#v", len(prompts.Items), prompts)
}