Move prompts into embedded Markdown assets

This commit is contained in:
2026-05-13 18:49:06 +00:00
parent d6126bf52b
commit 037121e9ce
43 changed files with 940 additions and 173 deletions

View File

@@ -11,6 +11,7 @@ import (
"gitea.maximumdirect.net/eric/audita/internal/core/schema"
"gitea.maximumdirect.net/eric/audita/internal/framework/proposals"
"gitea.maximumdirect.net/eric/audita/internal/framework/responseschema"
"gitea.maximumdirect.net/eric/audita/internal/prompts"
)
type LLMPromptBuilder func(validationPayload []LLMValidationItem, transcriptDescription string) ([]LLMMessage, error)
@@ -112,12 +113,20 @@ func (v *LLMBackedValidator) Validate(ctx context.Context, req Request) (Result,
artifacts := InteractionArtifacts{}
if req.DiagnosticsWriter != nil {
stage := fmt.Sprintf("%s:%s:batch-%04d", req.ModuleInstance, v.name, batch.BatchIndex)
promptMetadata := validatorPromptMetadata(v.validatorType)
artifacts, _ = req.DiagnosticsWriter.WriteInteraction(
stage,
map[string]any{
"validator_name": v.name,
"validator_type": v.validatorType,
"batch_index": batch.BatchIndex,
"prompt_metadata": map[string]any{
"prompt_id": promptMetadata.PromptID,
"prompt_version": promptMetadata.PromptVersion,
"prompt_source": promptMetadata.PromptSource,
"embedded_path": promptMetadata.EmbeddedPath,
"sha256": promptMetadata.SHA256,
},
"response_schema": map[string]any{
"id": responseSchema.ID,
"version": responseSchema.Version,
@@ -153,6 +162,23 @@ func (v *LLMBackedValidator) Validate(ctx context.Context, req Request) (Result,
return Result{ValidatorName: v.name, Decisions: all}, nil
}
func validatorPromptMetadata(validatorType LLMValidatorType) prompts.Metadata {
switch validatorType {
case LLMValidatorTypeSpokenFormPlausibility:
return prompts.MustLookupMetadata(prompts.PromptIDValidatorSpokenFormPlausibility)
case LLMValidatorTypeMeaningReversal:
return prompts.MustLookupMetadata(prompts.PromptIDValidatorMeaningReversalReview)
case LLMValidatorTypeEditorialReview:
return prompts.MustLookupMetadata(prompts.PromptIDValidatorEditorialReview)
case LLMValidatorTypeGrammarReview:
return prompts.MustLookupMetadata(prompts.PromptIDValidatorGrammarReview)
case LLMValidatorTypeSpokenWordReview:
return prompts.MustLookupMetadata(prompts.PromptIDValidatorSpokenWordReview)
default:
return prompts.Metadata{}
}
}
func errPayload(err error) any {
if err == nil {
return nil