shipwithjev

Catalog / Tools & apps

0211GitHub

typesafe-sdk-go

A Go client for the TypeSafe API.

RadixILS-Dev/typesafe-sdk-goREADME ↗
# TypeSafe AI Go SDK

[](https://github.com/RadixILS-Dev/typesafe-sdk-go/actions/workflows/ci.yml)
[](https://pkg.go.dev/github.com/RadixILS-Dev/typesafe-sdk-go)

A client for [TypeSafe AI](https://typesafe.ai). The wire
format and default retry behavior follow the
[Python SDK v0.6.0](https://github.com/typesafe-ai/typesafe-sdk-python/tree/420ef4ffb612d5a539a1e0f0fe883ff6770340af),
with a smaller, Go-native API.

## Quick start

Requires Go 1.26 or later. The module declares `go 1.26` as its minimum; CI
tests that version and the latest stable release.

```sh
go get github.com/RadixILS-Dev/typesafe-sdk-go
export TYPESAFE_API_KEY='your-api-key'
```

Import `github.com/RadixILS-Dev/typesafe-sdk-go` as package `typesafe`:

```go
client, err := typesafe.NewClient()
if err != nil {
    log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

result, err := client.SystemOne(ctx, "I was charged twice. Please help ASAP.", typesafe.Questions{
    "billing": typesafe.Noul{Instructions: "Is this about billing?"},
    "tone": typesafe.Choice{
        Instructions: "What is the tone?",
        Criteria: map[string]string{"calm": "", "angry": ""},
    },
    "urgency": typesafe.Score{
        Instructions: "How urgent is this?",
        Criteria: []string{"low", "medium", "high"},
    },
})
if err != nil {
    log.Fatal(err)
}
fmt.Println(result.Nouls["billing"].Noul, result.Choices["tone"].Choice, result.Scores["urgency"].Score)
```

The complete program is in [`examples/basic/main.go`](examples/basic/main.go).
`go run ./examples/basic` makes a real API request.

## Configuration

`NewClient()` uses environment variables and defaults. For explicit settings:

```go
client, err := typesafe.NewClient(
    typesafe.WithAPIKey("your-api-ke

Also filed under Tools & apps

  1. 0573

    Support chat: agent offered a human escalation path

    A frustrated customer hits a bot loop twice; the judge checks whether a human handoff was offered.

    everyai-com · Tools & apps

  2. 0572

    Subscription cancel: effective date is explicit

    An agent cancels a subscription; the judge checks the exact date the cancellation takes effect.

    everyai-com · Tools & apps

  3. 0571

    Sales quote: numbers match the official price list

    An agent quotes $29/seat against a price list; the judge checks the quote matches exactly.

    everyai-com · Tools & apps

  4. 0570

    Refund chat: agent stated the amount before issuing it

    A support agent issues a $42.50 refund; the judge checks the exact amount was stated before the refund was confirmed.

    everyai-com · Tools & apps