Add shared metadata maps and stage-name helpers
This commit is contained in:
@@ -2,12 +2,12 @@ package glossary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/contracts"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/proposal_generation"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/proposals"
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/stagename"
|
||||
builtinvalidators "gitea.maximumdirect.net/eric/audita/internal/validators"
|
||||
)
|
||||
|
||||
@@ -60,18 +60,12 @@ func (m *Module) Propose(ctx context.Context, req contracts.ProposalRequest) (co
|
||||
Glossary: req.Glossary,
|
||||
Config: req.Config,
|
||||
Messages: messages,
|
||||
PromptMetadata: map[string]any{
|
||||
"prompt_id": proposalPromptMetadata().PromptID,
|
||||
"prompt_version": proposalPromptMetadata().PromptVersion,
|
||||
"prompt_source": proposalPromptMetadata().PromptSource,
|
||||
"embedded_path": proposalPromptMetadata().EmbeddedPath,
|
||||
"sha256": proposalPromptMetadata().SHA256,
|
||||
},
|
||||
StageName: proposalStageName(req),
|
||||
StartIndex: 0,
|
||||
LLMClient: req.LLMClient,
|
||||
Scheduler: req.LLMScheduler,
|
||||
DiagnosticsDir: req.DiagnosticsDir,
|
||||
PromptMetadata: proposalPromptMetadata().DiagnosticsMap(),
|
||||
StageName: stagename.ModuleProposal(req.RunSpec.InstanceName, sectionIndexPtr(req.Section)),
|
||||
StartIndex: 0,
|
||||
LLMClient: req.LLMClient,
|
||||
Scheduler: req.LLMScheduler,
|
||||
DiagnosticsDir: req.DiagnosticsDir,
|
||||
})
|
||||
if err != nil {
|
||||
return contracts.ProposalResult{}, err
|
||||
@@ -95,9 +89,10 @@ func transcriptForSection(transcript *schema.Transcript, section *contracts.Sect
|
||||
return &schema.Transcript{Segments: segments}
|
||||
}
|
||||
|
||||
func proposalStageName(req contracts.ProposalRequest) string {
|
||||
if req.Section == nil || req.Section.Index == 0 {
|
||||
return fmt.Sprintf("%s:proposal", req.RunSpec.InstanceName)
|
||||
func sectionIndexPtr(section *contracts.SectionMetadata) *int {
|
||||
if section == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Sprintf("%s:proposal:section-%04d", req.RunSpec.InstanceName, req.Section.Index)
|
||||
index := section.Index
|
||||
return &index
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user