1package main23import (4 "context"5 "fmt"6 "log"78 "github.com/FelineStateMachine/typesafe-go"9)1011func main() {12 if err := run(); err != nil {13 log.Fatal(err)14 }15}1617func run() error {18 client, err := typesafe.NewClient()19 if err != nil {20 return err21 }22 response, err := client.SystemOne(context.Background(), typesafe.SystemOneRequest{23 State: map[string]any{"text": "A customer asks for a refund."},24 Questions: map[string]typesafe.Question{25 "needs_review": typesafe.NoulQuestion{26 Instructions: "Does this need human review?",27 Criteria: &typesafe.NoulCriteria{28 True: "The request has risk or ambiguity.",29 False: "The request is routine and safe to automate.",30 },31 },32 "intent": typesafe.ChoiceQuestion{33 Instructions: "Classify the customer's intent.",34 Criteria: map[string]any{35 "refund": "The customer wants money returned.",36 "question": "The customer is asking for information.",37 },38 },39 "priority": typesafe.ScoreQuestion{40 Instructions: "Score urgency from low to high.",41 Criteria: []any{"low", "medium", "high"},42 },43 },44 })45 if err != nil {46 return err47 }48 needsReview, err := response.Noul("needs_review")49 if err != nil {50 return err51 }52 intent, err := response.Choice("intent")53 if err != nil {54 return err55 }56 priority, err := response.Score("priority")57 if err != nil {58 return err59 }60 fmt.Printf("review probability: %.3f\nintent: %s\npriority: %.1f\n", needsReview.Noul, intent.Choice, priority.Score)61 return nil62}