Complete Phase 8 deterministic validators
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"gitea.maximumdirect.net/eric/audita/internal/core/config"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/proposals"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/validators"
|
||||
)
|
||||
|
||||
// StructuredLLMClient provides provider-agnostic structured completion.
|
||||
@@ -27,7 +28,7 @@ type TranscriptModule interface {
|
||||
// Validator evaluates candidate proposals and returns one decision per proposal index.
|
||||
type Validator interface {
|
||||
Name() string
|
||||
Validate(ctx context.Context, req ValidationRequest) ([]ValidationDecision, error)
|
||||
Validate(ctx context.Context, req ValidationRequest) (validators.Result, error)
|
||||
}
|
||||
|
||||
// StructuredCompletionRequest is a transport-neutral structured completion request.
|
||||
@@ -90,19 +91,7 @@ type ProposalRequest struct {
|
||||
}
|
||||
|
||||
// ValidationRequest is the input to validator execution.
|
||||
type ValidationRequest struct {
|
||||
ExecutionContext
|
||||
RunSpec ModuleRunSpec `json:"run_spec"`
|
||||
CandidateProposals []proposals.EnrichedCorrectionProposal `json:"candidate_proposals"`
|
||||
}
|
||||
|
||||
// ValidationDecision is one validator decision for one proposal index.
|
||||
type ValidationDecision struct {
|
||||
ProposalIndex int `json:"proposal_index"`
|
||||
Approved bool `json:"approved"`
|
||||
Confidence *float64 `json:"confidence,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
}
|
||||
type ValidationRequest = validators.Request
|
||||
|
||||
// ResolveModuleRunSpecs deterministically resolves instance names from logical keys.
|
||||
// Repeated keys are suffixed with _<n> (1-based), while singleton keys keep their raw key.
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/internal/core/chunking"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/proposals"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/validators"
|
||||
)
|
||||
|
||||
type fakeLLMClient struct{}
|
||||
@@ -22,13 +23,13 @@ type fakeValidator struct{}
|
||||
|
||||
func (f *fakeValidator) Name() string { return "fake-validator" }
|
||||
|
||||
func (f *fakeValidator) Validate(ctx context.Context, req ValidationRequest) ([]ValidationDecision, error) {
|
||||
func (f *fakeValidator) Validate(ctx context.Context, req ValidationRequest) (validators.Result, error) {
|
||||
_ = ctx
|
||||
decisions := make([]ValidationDecision, len(req.CandidateProposals))
|
||||
for i, proposal := range req.CandidateProposals {
|
||||
decisions[i] = ValidationDecision{ProposalIndex: proposal.ProposalIndex, Approved: true}
|
||||
decisions := make([]validators.Decision, len(req.CandidateProposal))
|
||||
for i, proposal := range req.CandidateProposal {
|
||||
decisions[i] = validators.Decision{ProposalIndex: proposal.ProposalIndex, Approved: true, ReasonCode: validators.ReasonApproved, Message: "approved"}
|
||||
}
|
||||
return decisions, nil
|
||||
return validators.Result{ValidatorName: f.Name(), Decisions: decisions}, nil
|
||||
}
|
||||
|
||||
type fakeModule struct{}
|
||||
|
||||
Reference in New Issue
Block a user