64 lines
2.7 KiB
Go
64 lines
2.7 KiB
Go
package validators
|
|
|
|
import (
|
|
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
|
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/structuredoutput"
|
|
)
|
|
|
|
type LLMValidatorType string
|
|
|
|
const (
|
|
LLMValidatorTypeSpokenFormPlausibility LLMValidatorType = "spoken_form_plausibility"
|
|
LLMValidatorTypeMeaningReversal LLMValidatorType = "meaning_reversal"
|
|
LLMValidatorTypeEditorialReview LLMValidatorType = "editorial_review"
|
|
)
|
|
|
|
type StructuredCompletionRequest = structuredoutput.Request
|
|
type StructuredCompletionResponse = structuredoutput.Response
|
|
type StructuredLLMClient = structuredoutput.Client
|
|
|
|
// LLMValidationItem retains the internal proposal index until prompt encoding.
|
|
// BuildValidationVariables substitutes a one-based reference for each batch.
|
|
type LLMValidationItem struct {
|
|
CorrectionIndex int `json:"correction_index"`
|
|
SegmentID int `json:"-"`
|
|
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"`
|
|
NeighboringSegments []NeighboringSegment `json:"neighboring_segments,omitempty"`
|
|
GlossaryEntries []schema.GlossaryEntry `json:"glossary_entries,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"`
|
|
}
|
|
|
|
// LLMValidationDecision contains a request-local correction_index, not a proposal index.
|
|
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"`
|
|
}
|
|
|
|
// NeighboringSegment carries semantic context without internal transcript identity.
|
|
type NeighboringSegment struct {
|
|
Position string `json:"position"`
|
|
Speaker string `json:"speaker"`
|
|
Text string `json:"text"`
|
|
Categories []string `json:"categories,omitempty"`
|
|
}
|