31 lines
1.2 KiB
Go
31 lines
1.2 KiB
Go
|
|
package runner
|
||
|
|
|
||
|
|
import (
|
||
|
|
"gitea.maximumdirect.net/eric/audita/v4/internal/core/chunking"
|
||
|
|
"gitea.maximumdirect.net/eric/audita/v4/internal/core/config"
|
||
|
|
"gitea.maximumdirect.net/eric/audita/v4/internal/core/schema"
|
||
|
|
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/contracts"
|
||
|
|
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/structuredoutput"
|
||
|
|
)
|
||
|
|
|
||
|
|
type testRunInput struct {
|
||
|
|
Config *config.Config
|
||
|
|
Transcript *schema.Transcript
|
||
|
|
ModuleSpecs []contracts.ModuleRunSpec
|
||
|
|
Interactions structuredoutput.InteractionSink
|
||
|
|
Evidence *EvidenceSelection
|
||
|
|
Progress func(Progress)
|
||
|
|
}
|
||
|
|
|
||
|
|
func preparedTestInput(input testRunInput) RunInput {
|
||
|
|
cfg := chunking.ChunkingConfig{MaxSectionTokens: int(^uint(0) >> 1)}
|
||
|
|
if input.Config != nil {
|
||
|
|
cfg = chunking.ChunkingConfig{MaxSectionTokens: input.Config.Chunking.MaxSectionTokens, MinSectionTokens: input.Config.Chunking.MinSectionTokens, TargetSections: input.Config.Chunking.TargetSections}
|
||
|
|
}
|
||
|
|
sections, err := chunking.NewChunker(cfg).ChunkTranscript(input.Transcript)
|
||
|
|
if err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return RunInput{Sections: sections, Transcript: input.Transcript, ModuleSpecs: input.ModuleSpecs, Interactions: input.Interactions, Evidence: input.Evidence, Progress: input.Progress}
|
||
|
|
}
|