Versions in this module Expand all Collapse all v0 v0.1.1 Nov 11, 2026 v0.1.0 Oct 14, 2026 Changes in this version + const DefaultBatchConcurrency + const MaxChoiceOptions + const MaxEvidenceRefs + const MaxIdentifierLength + const MaxQuestionIDLength + const MaxScoreLevels + const MinChoiceOptions + const MinScoreLevels + const SchemaVersion + var ErrInvalidConfig = errors.New("discern: invalid configuration") + var ErrInvalidPolicy = errors.New("discern: invalid policy") + var ErrInvalidRecord = errors.New("discern: invalid result record") + var ErrInvalidRequest = errors.New("discern: invalid request") + var ErrMalformedResponse = errors.New("discern: malformed provider response") + var ErrPartialFailure = errors.New("discern: partial failure") + var ErrRejected = errors.New("discern: rejected by provider") + var ErrUnsupported = errors.New("discern: unsupported by provider") + type Adapter interface + Model func() string + Prepare func(req *Request) (Call, error) + Provider func() Provider + type Agreement struct + MaxDifference float64 + type Answer struct + Choice *ChoiceAnswer + Kind Kind + Noul *NoulAnswer + QuestionID string + Score *ScoreAnswer + type BatchItem struct + Err error + Result *Result + type Call func(ctx context.Context) (*Observation, error) + type Check struct + ID string + Metric Metric + Model string + Op Op + Provider Provider + Threshold float64 + type CheckResult struct + Metric Metric + Observed *float64 + ObservedModel string + Op Op + Passed bool + Provider Provider + RuleID string + ScopeModel string + ScopeProvider Provider + Skipped ReasonCode + Threshold float64 + type ChoiceAnswer struct + Confidence *float64 + Option string + Probabilities []OptionProbability + type ChoiceOption struct + Description Value + ID string + func Opt(id string, description Value) ChoiceOption + type EvalOption func(*evalConfig) + func WithPolicy(p Policy) EvalOption + func WithoutPolicy() EvalOption + type Evaluator struct + func New(opts ...Option) (*Evaluator, error) + func (e *Evaluator) Evaluate(ctx context.Context, req Request, opts ...EvalOption) (*Result, error) + func (e *Evaluator) EvaluateBatch(ctx context.Context, reqs []Request, opts ...EvalOption) ([]BatchItem, error) + type Failure struct + Codes []int + Kind FailureKind + RayID string + RequestID string + RetryAfter *time.Duration + StatusCode int + type FailureKind string + const FailureAdapter + const FailureCanceled + const FailureDeadlineExceeded + const FailureMalformed + const FailureRejected + const FailureTimeout + const FailureTooLarge + const FailureTransport + type Kind string + const KindChoice + const KindNoul + const KindScore + type LevelProbability struct + Level string + Probability float64 + type Library struct + Module string + Version string + type Metric string + const MetricAgreement + const MetricChoiceProbability + const MetricConfidence + const MetricNoul + const MetricScore + type NoulAnswer struct + Value float64 + type Observation struct + Answers []Answer + Model string + RayID string + RequestID string + Usage *Usage + func (o *Observation) Answer(questionID string) (Answer, bool) + func (o *Observation) Choice(questionID string) (ChoiceAnswer, bool) + func (o *Observation) Clone() Observation + func (o *Observation) Noul(questionID string) (NoulAnswer, bool) + func (o *Observation) Score(questionID string) (ScoreAnswer, bool) + type Op string + const Above + const AtLeast + const AtMost + const Below + const Equal + type Option func(*config) + func WithAdapter(a Adapter) Option + func WithBatchConcurrency(n int) Option + func WithDefaultPolicy(p Policy) Option + type OptionProbability struct + Option string + Probability float64 + type Outcome struct + Elapsed time.Duration + Failure *Failure + Observation *Observation + Provider Provider + RequestedModel string + Status OutcomeStatus + type OutcomeStatus string + const OutcomeFailed + const OutcomeSucceeded + type Overall struct + Status RecommendationStatus + Uncovered []string + type Policy struct + AllowPartial bool + PreferOnConflict Provider + Questions []QuestionPolicy + Version string + type PolicySnapshot struct + Policy *Policy + Source PolicySource + Unmatched []string + type PolicySource string + const PolicyCallOverride + const PolicyClientDefault + const PolicyDisabled + const PolicyNone + const PolicyRecommend + type Provider string + const Clef + const Jev + type ProviderError struct + Codes []int + HasRetryAfter bool + Kind FailureKind + Provider Provider + RayID string + RequestID string + RetryAfter time.Duration + StatusCode int + func NewProviderError(provider Provider, kind FailureKind, cause error, messages ...string) *ProviderError + func (e ProviderError) Error() string + func (e ProviderError) GoString() string + func (e ProviderError) Is(target error) bool + func (e ProviderError) ProviderMessages() []string + func (e ProviderError) Unwrap() error + type ProviderSet string + const ClefOnly + const JevAndClef + const JevOnly + func (s ProviderSet) Has(p Provider) bool + func (s ProviderSet) Providers() []Provider + type Question struct + ID string + Instructions Value + Kind Kind + Levels []ScoreLevel + No Value + Options []ChoiceOption + Yes Value + func Choice(id string, instructions Value, options ...ChoiceOption) Question + func Noul(id string, instructions Value) Question + func Score(id string, instructions Value, levels ...ScoreLevel) Question + type QuestionInfo struct + ID string + Kind Kind + Levels []string + Options []string + type QuestionPolicy struct + Agreement *Agreement + Checks []Check + Question string + type ReasonCode string + const ReasonAgreementMissing + const ReasonBelowThreshold + const ReasonMetricAbsent + const ReasonModelCheckSkipped + const ReasonModelMismatch + const ReasonNoApplicableCheck + const ReasonNoPolicy + const ReasonPartialSingleProvider + const ReasonPreferredOnConflict + const ReasonProviderFailed + const ReasonProvidersAgree + const ReasonProvidersDisagree + const ReasonQuestionNotInPolicy + const ReasonThresholdsMet + type Recommendation struct + Checks []CheckResult + QuestionID string + Reasons []ReasonCode + Selected *Selected + Status RecommendationStatus + Summary string + type RecommendationStatus string + const Accepted + const BelowThreshold + const Incomplete + const NoRule + const NotApplicable + const ReviewRequired + type Redaction struct + CorrelationID bool + EvidenceRefs bool + RequestIDs bool + Usage bool + type Request struct + CorrelationID string + EvidenceRefs []string + Providers ProviderSet + Questions []Question + State Value + type Result struct + CorrelationID string + Elapsed time.Duration + EvidenceRefs []string + Library Library + Outcomes []Outcome + Overall Overall + Policy PolicySnapshot + Providers ProviderSet + Questions []QuestionInfo + Recommendations []Recommendation + Redacted []string + SchemaVersion string + StartedAt time.Time + Status ResultStatus + func ParseResult(data []byte) (*Result, error) + func Recommend(res *Result, policy Policy) (*Result, error) + func (r *Result) Clone() *Result + func (r *Result) Observation(p Provider) (Observation, bool) + func (r *Result) Outcome(p Provider) (Outcome, bool) + func (r *Result) Recommendation(questionID string) (Recommendation, bool) + func (r *Result) Redact(opts Redaction) *Result + func (r *Result) SelectedAnswers(questionID string) []Answer + type ResultStatus string + const Complete + const Failed + const Partial + type ScoreAnswer struct + Confidence *float64 + Probabilities []LevelProbability + Value float64 + func (s ScoreAnswer) Nearest() string + type ScoreLevel struct + Description Value + ID string + func Level(id string, description Value) ScoreLevel + type Selected struct + Option string + Providers []Provider + type Usage struct + InputTokens *int64 + Neurons *float64 + OutputTokens *int64 + type ValidationError struct + Err error + Field string + Reason string + func (e ValidationError) Error() string + func (e ValidationError) Unwrap() error + type Value struct + func JSON(b []byte) Value + func Marshal(v any) (Value, error) + func Text(s string) Value + func (v Value) AppendJSON(dst []byte) ([]byte, error) + func (v Value) IsZero() bool + func (v Value) MarshalJSON() ([]byte, error)