Retain selected glossary instructions
This commit is contained in:
@@ -31,6 +31,11 @@ type TranscriptModule interface {
|
||||
type StructuredCompletionRequest = structuredoutput.Request
|
||||
type StructuredCompletionResponse = structuredoutput.Response
|
||||
|
||||
type GlossaryInstruction struct {
|
||||
Collection string
|
||||
Text string
|
||||
}
|
||||
|
||||
// ModuleRunSpec identifies one resolved module instance in a pipeline.
|
||||
type ModuleRunSpec struct {
|
||||
ModuleKey string `json:"module_key"`
|
||||
@@ -40,6 +45,7 @@ type ModuleRunSpec struct {
|
||||
ID *string `json:"-"`
|
||||
Settings config.Stage `json:"-"`
|
||||
Glossary []glossary.Entry `json:"-"`
|
||||
GlossaryInstructions []GlossaryInstruction `json:"-"`
|
||||
ProtectedTerms []glossary.Term `json:"-"`
|
||||
GlossaryView *validators.GlossaryView `json:"-"`
|
||||
GlossaryVariables *promptcontext.GlossaryVariables `json:"-"`
|
||||
@@ -140,10 +146,16 @@ func ResolveModuleRunSpecs(cfg *config.Config) []ModuleRunSpec {
|
||||
key := GlossarySelection(item)
|
||||
if prior, ok := selections[key]; ok {
|
||||
spec.Glossary = specs[prior].Glossary
|
||||
spec.GlossaryInstructions = specs[prior].GlossaryInstructions
|
||||
spec.ProtectedTerms = specs[prior].ProtectedTerms
|
||||
continue
|
||||
}
|
||||
selected := glossary.Select(cfg.GlossaryCollections, item.Glossaries)
|
||||
for _, name := range item.Glossaries {
|
||||
if collection, ok := cfg.GlossaryCollections[name]; ok {
|
||||
spec.GlossaryInstructions = append(spec.GlossaryInstructions, GlossaryInstruction{Collection: name, Text: collection.Instruction})
|
||||
}
|
||||
}
|
||||
protected := glossary.Select(cfg.GlossaryCollections, item.ProtectedTerms)
|
||||
var excluded []glossary.Entry
|
||||
if key.exempt {
|
||||
|
||||
Reference in New Issue
Block a user