jev

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL           = "https://api.typesafe.ai"
	OpenRouterDefaultBaseURL = "https://openrouter.ai"
)

Variables

This section is empty.

Functions

func IsTokenLimitError

func IsTokenLimitError(err error) bool

Types

type APIError

type APIError struct {
	Provider   string
	StatusCode int
	RequestID  string
	Body       string
}

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client interface {
	Evaluate(context.Context, EvaluationRequest) (EvaluationResponse, error)
	Stats() Stats
}

type EvaluationRequest

type EvaluationRequest struct {
	Model           string          `json:"model"`
	State           string          `json:"state"`
	Questions       []Question      `json:"questions"`
	StructuredState json.RawMessage `json:"structured_state,omitempty"`
}

type EvaluationResponse

type EvaluationResponse struct {
	Probabilities map[string]float64
	Model         string
	Provider      string
	RequestID     string
	Usage         *Usage
}

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

func NewHTTPClient

func NewHTTPClient(options HTTPOptions) (*HTTPClient, error)

func NewOpenRouterClient

func NewOpenRouterClient(options HTTPOptions) (*HTTPClient, error)

func NewProviderClient

func NewProviderClient(provider string, options HTTPOptions) (*HTTPClient, error)

func (*HTTPClient) Evaluate

func (c *HTTPClient) Evaluate(ctx context.Context, request EvaluationRequest) (EvaluationResponse, error)

func (*HTTPClient) Stats

func (c *HTTPClient) Stats() Stats

type HTTPOptions

type HTTPOptions struct {
	BaseURL    string
	APIKey     string
	Timeout    time.Duration
	MaxRetries int
	HTTPClient *http.Client
}

type Question

type Question struct {
	ID           string                 `json:"id"`
	Instructions string                 `json:"instructions"`
	Criteria     *decision.NoulCriteria `json:"criteria,omitempty"`
}

type Stats

type Stats struct {
	UsageResponses int `json:"usage_responses"`
	Requests       int `json:"jev_requests"`
	Retries        int `json:"retries,omitempty"`
	InputTokens    int `json:"input_tokens,omitempty"`
	OutputTokens   int `json:"output_tokens,omitempty"`
}

type Usage

type Usage struct {
	InputTokens  int      `json:"input_tokens"`
	OutputTokens int      `json:"output_tokens"`
	CostUSD      *float64 `json:"cost,omitempty"`
}

Jump to

Keyboard shortcuts

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