Include glossary guidance in proposal conversations
This commit is contained in:
@@ -35,6 +35,7 @@ func ExecuteModuleProposal(ctx context.Context, req ModuleProposalRequest) (cont
|
||||
if err != nil {
|
||||
return contracts.ProposalResult{}, err
|
||||
}
|
||||
prepared.InstructionsBlock = promptcontext.GlossaryInstructionsBlock(req.ProposalRequest.RunSpec.GlossaryInstructions)
|
||||
glossary = &prepared
|
||||
}
|
||||
variables, err := buildProposalVariables(
|
||||
|
||||
@@ -15,6 +15,7 @@ func buildProposalVariables(transcript *schema.Transcript, glossary promptcontex
|
||||
return map[string]string{
|
||||
"TranscriptDescriptionBlock": promptcontext.TranscriptDescriptionBlock(transcriptDescription),
|
||||
"GlossaryJSON": glossary.ContextJSON,
|
||||
"GlossaryInstructionsBlock": glossary.InstructionsBlock,
|
||||
"ProtectedTermsJSON": glossary.ProtectionJSON,
|
||||
"SectionJSON": string(sectionJSON),
|
||||
}, nil
|
||||
|
||||
@@ -16,11 +16,12 @@ func TestBuildProposalVariablesPreservesSectionGlossaryAndDescription(t *testing
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
prepared.InstructionsBlock = "party: use this guidance"
|
||||
variables, err := buildProposalVariables(transcript, prepared, 0, " Fantasy names ")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(variables["SectionJSON"], `"section_index": 0`) || !strings.Contains(variables["SectionJSON"], "gestures") || !strings.Contains(variables["GlossaryJSON"], "Jesters") || !strings.Contains(variables["TranscriptDescriptionBlock"], "Fantasy names") {
|
||||
if !strings.Contains(variables["SectionJSON"], `"section_index": 0`) || !strings.Contains(variables["SectionJSON"], "gestures") || !strings.Contains(variables["GlossaryJSON"], "Jesters") || !strings.Contains(variables["TranscriptDescriptionBlock"], "Fantasy names") || variables["GlossaryInstructionsBlock"] != prepared.InstructionsBlock {
|
||||
t.Fatalf("encoded variables incomplete: %+v", variables)
|
||||
}
|
||||
empty, err := buildProposalVariables(transcript, prepared, 0, " ")
|
||||
|
||||
Reference in New Issue
Block a user