Documentation
¶
Overview ¶
Package jev adapts an injected Jev evaluation client to Reliquary's judgment contracts.
Jev executes typed evaluations that return strict probabilities and enums instead of generated prose. This adapter owns only the mapping between the provider-neutral judgment types and the Jev call/result shapes: it translates each judgment request into one typed Call, forwards it to the injected Client, maps the provider-shaped Result back, and validates the pair with the judgment package. Transport, credentials, endpoints, retry policy, and persistent state belong entirely to the injected Client; the adapter performs no network, file, or environment I/O and retains no state beyond the client reference.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilClient = errors.New("jev adapter: client must not be nil")
ErrNilClient reports construction with a missing Jev client.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter maps an injected Client onto Reliquary's judgment contracts. The zero value is unusable; construct it with New.
func New ¶
New constructs the adapter over an injected Jev client. It performs no network, file, or environment I/O and stores nothing beyond the client.
Example ¶
package main
import (
"context"
"fmt"
"github.com/dotcommander/reliquary/adapter/jev"
)
type staticJevClient struct{}
func (staticJevClient) Evaluate(_ context.Context, call jev.Call) (jev.Result, error) {
return jev.Result{
Selected: "search",
Distribution: []jev.Mass{
{Option: "search", Probability: 1.0},
},
Confidence: 1.0,
}, nil
}
func main() {
adapter, err := jev.New(staticJevClient{})
fmt.Println(adapter != nil, err == nil)
}
Output: true true
func (*Adapter) Ask ¶
Ask routes a strict yes/no question through the injected client, maps the provider result onto a judgment Noul, and validates the pair.
type Call ¶
type Call struct {
Kind Kind
Task string
Context []string
Options []Option
Target string
Question string
}
Call is one typed Jev evaluation request. Kind selects the primitive and which fields Jev reads: choice uses Task, Context, and Options; score uses Task, Context, and Target; noul uses Question and Context.
type Client ¶
Client is the Jev provider boundary this adapter wraps. Implementations own transport, credentials, and retry policy; they perform exactly one typed evaluation per call so the adapter stays free of provider state.
type Kind ¶
type Kind string
Kind identifies the Jev primitive a Call requests.
const ( // KindChoice requests a definitive pick plus a probability distribution // over the call's option set. KindChoice Kind = "choice" // KindScore requests a 0-100 rating for the call's target. KindScore Kind = "score" // KindNoul requests one strict yes/no verdict for the call's question. KindNoul Kind = "noul" )