Files
audita/internal/framework/validators/llm_models.go

54 lines
2.1 KiB
Go

package validators
import (
"gitea.maximumdirect.net/eric/audita/internal/core/schema"
"gitea.maximumdirect.net/eric/audita/internal/framework/structuredoutput"
)
type LLMValidatorType string
const (
LLMValidatorTypeSpokenFormPlausibility LLMValidatorType = "spoken_form_plausibility"
LLMValidatorTypeMeaningReversal LLMValidatorType = "meaning_reversal"
LLMValidatorTypeEditorialReview LLMValidatorType = "editorial_review"
LLMValidatorTypeGrammarReview LLMValidatorType = "grammar_review"
LLMValidatorTypeSpokenWordReview LLMValidatorType = "spoken_word_review"
)
type StructuredCompletionRequest = structuredoutput.Request
type StructuredCompletionResponse = structuredoutput.Response
type StructuredLLMClient = structuredoutput.Client
// LLMValidationItem is one candidate correction payload passed to LLM validators.
type LLMValidationItem struct {
CorrectionIndex int `json:"correction_index"`
SegmentID int `json:"id"`
OriginalText string `json:"original_text"`
CorrectedText string `json:"corrected_text"`
OriginalSegmentText string `json:"original_segment_text"`
CorrectedSegmentText string `json:"corrected_segment_text"`
Categories []string `json:"categories,omitempty"`
}
// LLMValidationRequest is the canonical request model for LLM-backed validators.
type LLMValidationRequest struct {
ValidatorName string `json:"validator_name"`
ValidatorType LLMValidatorType `json:"validator_type"`
ModuleKey string `json:"module_key"`
ModuleInstance string `json:"module_instance"`
ReplacementPolicy string `json:"replacement_policy"`
Glossary *schema.Glossary `json:"-"`
Items []LLMValidationItem `json:"corrections"`
}
type LLMValidationDecision struct {
CorrectionIndex int `json:"correction_index"`
Approved bool `json:"approved"`
Confidence float64 `json:"confidence"`
Reason string `json:"reason"`
}
type LLMValidationResponse struct {
Validations []LLMValidationDecision `json:"validations"`
}