Ask an AI model bounded questions about any text. Get typed answers back, and keep every decision in plain Go.
if and switch, with thresholds you measured.resp, err := client.SystemOne(ctx, &typesafe.SystemOneParams{
State: ticket.Body,
Questions: typesafe.Questions{
"urgent": typesafe.Noul{Instructions: "Is this urgent?"},
"topic": typesafe.Choice{
Instructions: "What is this about?",
Criteria: typesafe.ChoiceCriteria{
"billing": "Charges or invoices",
"bug": "Something is broken",
},
},
},
})
if err != nil {
return err
}
if resp.Nouls()["urgent"].Noul >= 0.8 &&
resp.Choices()["topic"].Choice == "billing" {
page(billingOnCall)
}
State and named questions
Checked before any network I/O
429, 5xx, timeouts: backoff with jitter
Nouls(), Choices(), Scores()
if / switch on typed values
errors.As:*RateLimitError*TimeoutError*ResponseValidationErrorStandard library only. CI proves it.
Noul, Choice, and Score map to their own structs.
Backoff, jitter, Retry-After, per-call budget.
One taxonomy, matched with errors.As.
One client per process, verified with -race.
HTTPS only, secrets redacted from slog logs.
MIT licensed · community maintained · not affiliated with TypeSafe AI