TypeSafe.ai Jev Go SDK https://docs.typesafe.ai
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-21 22:16:35 -06:00
.github fix: funding format 2026-09-21 22:15:05 -06:00
examples/basic docs: add example 2026-09-21 21:45:31 -06:00
.gitignore Setup repo 2026-09-21 18:20:37 -06:00
answers.go chore: cleanup comments 2026-09-21 21:28:37 -06:00
answers_test.go tests: add tests 2026-09-21 21:57:46 -06:00
client.go chore: cleanup comments 2026-09-21 21:28:37 -06:00
client_test.go tests: add tests 2026-09-21 21:57:46 -06:00
doc.go Setup repo 2026-09-21 18:20:37 -06:00
errors.go chore: cleanup comments 2026-09-21 21:28:37 -06:00
errors_test.go tests: add tests 2026-09-21 21:57:46 -06:00
go.mod chore: bump go version to 1.27.1 2026-09-21 20:08:52 -06:00
LICENSE Initial commit 2026-09-18 21:42:12 -06:00
questions.go chore: cleanup comments 2026-09-21 21:28:37 -06:00
questions_test.go tests: add tests 2026-09-21 21:57:46 -06:00
README.md docs: update readme and add various github files 2026-09-21 21:58:06 -06:00
systemone.go chore: cleanup comments 2026-09-21 21:28:37 -06:00
systemone_test.go tests: add tests 2026-09-21 21:57:46 -06:00

jev-go

Go Reference CI License: MIT

A Go SDK for TypeSafe's Jev API.

Install

go get github.com/kyledickey/jev-go

The package name is jev.

Usage

The client reads your key from TYPESAFE_API_KEY by default.

client, err := jev.NewClient()
if err != nil {
	log.Fatal(err)
}

resp, err := client.SystemOne(ctx, jev.SystemOneRequest{
	State: "I bought this product 10 days ago and I want a full refund.",
	Questions: map[string]jev.Question{
		"eligible": jev.NoulQuestion{
			Instructions: "Is the customer eligible for a refund?",
			Criteria: &jev.NoulCriteria{
				True: "Full refunds are allowed within 30 days of purchase.",
			},
		},
	},
})
if err != nil {
	log.Fatal(err)
}

if a, ok := resp.Answers["eligible"].(*jev.NoulAnswer); ok {
	fmt.Printf("eligible: %.2f\n", a.Noul)
}

There are three question types, each with a matching answer type:

Question Answer
NoulQuestion *NoulAnswer
ChoiceQuestion *ChoiceAnswer
ScoreQuestion *ScoreAnswer

See the Jev docs for how each one works, and examples/basic for a full program.

Options

client, err := jev.NewClient(
	jev.WithAPIKey("..."),
	jev.WithHTTPClient(&http.Client{Timeout: 10 * time.Second}),
	jev.WithBaseURL("https://api.typesafe.ai/v1"),
)

Errors

Non-2xx responses come back as *jev.APIError, which has the status code, headers, and raw body.

var apiErr *jev.APIError
if errors.As(err, &apiErr) {
	log.Printf("status %d: %s", apiErr.StatusCode, apiErr.Body)
}

Requests aren't retried, so wrap calls yourself if you need that.

Contributing

Issues and PRs are welcome. For anything bigger than a small fix, it's worth opening an issue first so we can talk it through.

Before sending a PR, make sure these pass (CI runs the same checks):

gofmt -l .
go vet ./...
go test -race ./...

License

MIT