Documentation
¶
Overview ¶
Package jev provides a client for TypeSafe AI's Jev System One API.
Jev is a decision model, not an LLM: it evaluates state against named, typed questions and returns probabilities rather than generated text.
Index ¶
Constants ¶
const ( // DefaultBaseURL is the TypeSafe AI API root. DefaultBaseURL = "https://api.typesafe.ai" // DefaultModel tracks TypeSafe's current Jev alias. DefaultModel = "jev-latest" )
Variables ¶
var ( // ErrNoAPIKey means a request was attempted without a TypeSafe API key. ErrNoAPIKey = errors.New("jev: no API key configured") // ErrInvalidRequest means the request cannot satisfy the System One contract. ErrInvalidRequest = errors.New("jev: invalid request") // ErrInvalidResponse means TypeSafe returned a response that does not match the request. ErrInvalidResponse = errors.New("jev: invalid response") )
Functions ¶
This section is empty.
Types ¶
type Answer ¶
type Answer struct {
Type QuestionType `json:"type"`
Noul *float64 `json:"noul,omitempty"`
Choice string `json:"choice,omitempty"`
Score *float64 `json:"score,omitempty"`
Confidence float64 `json:"confidence,omitempty"`
Probabilities map[string]float64 `json:"probabilities,omitempty"`
Legend map[string]interface{} `json:"legend,omitempty"`
}
Answer is one typed answer returned by Jev. Only fields matching Type are set.
type ChoiceQuestion ¶
type ChoiceQuestion struct {
Type QuestionType `json:"type"`
Instructions interface{} `json:"instructions,omitempty"`
Criteria map[string]interface{} `json:"criteria"`
}
ChoiceQuestion asks Jev to select one of the named criteria.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls TypeSafe AI's System One endpoint.
type NoulCriteria ¶
type NoulCriteria struct {
True interface{} `json:"true,omitempty"`
False interface{} `json:"false,omitempty"`
}
NoulCriteria optionally describes the true and false outcomes.
type NoulQuestion ¶
type NoulQuestion struct {
Type QuestionType `json:"type"`
Instructions interface{} `json:"instructions,omitempty"`
Criteria *NoulCriteria `json:"criteria,omitempty"`
}
NoulQuestion asks for the probability that a yes/no judgment is true.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithBaseURL ¶
WithBaseURL overrides the TypeSafe API root, primarily for gateways and tests.
func WithHTTPClient ¶
WithHTTPClient replaces the HTTP transport. The client is used as supplied.
type Question ¶
type Question interface {
// contains filtered or unexported methods
}
Question is implemented by the three Jev question primitives.
func NoulWithCriteria ¶
func NoulWithCriteria(instructions, whenTrue, whenFalse interface{}) Question
NoulWithCriteria creates a yes/no question with descriptions of both outcomes.
type QuestionType ¶
type QuestionType string
QuestionType identifies the shape of a Jev question and its answer.
const ( // QuestionTypeNoul is a yes/no judgment returned as the probability of yes. QuestionTypeNoul QuestionType = "noul" // QuestionTypeChoice selects one label from caller-provided criteria. QuestionTypeChoice QuestionType = "choice" // QuestionTypeScore evaluates state against an ordered rubric. QuestionTypeScore QuestionType = "score" )
type Request ¶
type Request struct {
State interface{} `json:"state"`
Questions map[string]Question `json:"questions"`
Model string `json:"model,omitempty"`
}
Request evaluates State against one or more named Questions.
type Response ¶
type Response struct {
Model string `json:"model"`
Answers map[string]Answer `json:"answers"`
Usage Usage `json:"usage"`
RequestID string `json:"-"`
}
Response contains answers keyed by request question name.
type ScoreQuestion ¶
type ScoreQuestion struct {
Type QuestionType `json:"type"`
Instructions interface{} `json:"instructions,omitempty"`
Criteria []interface{} `json:"criteria"`
}
ScoreQuestion asks Jev to evaluate state against an ordered rubric.