jev

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 4 Imported by: 0

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

View Source
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

func New(client Client) (*Adapter, error)

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

func (a *Adapter) Ask(ctx context.Context, request judgment.NoulRequest) (judgment.Noul, error)

Ask routes a strict yes/no question through the injected client, maps the provider result onto a judgment Noul, and validates the pair.

func (*Adapter) Choose

func (a *Adapter) Choose(ctx context.Context, request judgment.ChoiceRequest) (judgment.Choice, error)

Choose routes a choice request through the injected client, maps the provider result onto a judgment Choice, and validates the pair.

func (*Adapter) Score

func (a *Adapter) Score(ctx context.Context, request judgment.ScoreRequest) (judgment.Score, error)

Score routes a score request through the injected client, maps the provider result onto a judgment Score, 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

type Client interface {
	Evaluate(ctx context.Context, call Call) (Result, error)
}

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"
)

type Mass

type Mass struct {
	Option      string
	Probability float64
}

Mass is the probability mass one choice option received from Jev.

type Option

type Option struct {
	ID          string
	Description string
}

Option is one enumerable choice target in a Jev call.

type Result

type Result struct {
	Selected     string
	Distribution []Mass
	Value        float64
	Verdict      string
	Confidence   float64
}

Result is one typed Jev evaluation response. Choice fills Selected and Distribution; score fills Value and Confidence; noul fills Verdict and Confidence.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL