Skip to content

Commit 2192d9e

Browse files
committed
Add TestExpansion field to PromptPexModelAliases; update related functions and options
1 parent 1d06bed commit 2192d9e

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

cmd/generate/options.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ func GetDefaultOptions() *PromptPexOptions {
1414
FilterTestCount: util.Ptr(5),
1515
Verbose: util.Ptr(false),
1616
Models: &PromptPexModelAliases{
17-
Rules: util.Ptr("openai/gpt-4o"),
18-
Tests: util.Ptr("openai/gpt-4o"),
19-
Groundtruth: util.Ptr("openai/gpt-4o"),
17+
Rules: util.Ptr("openai/gpt-4o"),
18+
Tests: util.Ptr("openai/gpt-4o"),
19+
Groundtruth: util.Ptr("openai/gpt-4o"),
20+
TestExpansion: util.Ptr("openai/gpt-4o"),
2021
},
2122
}
2223
}

cmd/generate/pipeline.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ func (h *generateCommandHandler) expandTests(context *PromptPexContext) error {
376376

377377
for _, test := range context.Tests {
378378
// Generate expanded versions of each test
379-
expandedTests, err := h.expandSingleTest(test, context)
379+
expandedTests, err := h.expandSingleTest(test)
380380
if err != nil {
381381
h.cfg.WriteToOut(fmt.Sprintf("Failed to expand test: %v", err))
382382
continue
@@ -395,14 +395,21 @@ func (h *generateCommandHandler) expandTests(context *PromptPexContext) error {
395395
}
396396

397397
// expandSingleTest expands a single test into multiple variations
398-
func (h *generateCommandHandler) expandSingleTest(test PromptPexTest, context *PromptPexContext) ([]PromptPexTest, error) {
398+
func (h *generateCommandHandler) expandSingleTest(test PromptPexTest) ([]PromptPexTest, error) {
399399
prompt := fmt.Sprintf(`Given this test case, generate 2-3 variations that test similar scenarios but with different inputs.
400400
Keep the same scenario type but vary the specific details.
401401
402-
Original test:
403-
Scenario: %s
404-
Input: %s
405-
Reasoning: %s
402+
<original_test>
403+
<scenario>
404+
%s
405+
</scenario>
406+
<input>
407+
%s
408+
</input>
409+
<reasoning>
410+
%s
411+
</reasoning>
412+
</original_test>
406413
407414
Generate variations in JSON format as an array of objects with "scenario", "testinput", and "reasoning" fields.`,
408415
*test.Scenario, test.TestInput, *test.Reasoning)
@@ -412,7 +419,7 @@ Generate variations in JSON format as an array of objects with "scenario", "test
412419
}
413420

414421
options := azuremodels.ChatCompletionOptions{
415-
Model: "openai/gpt-4o-mini", // GitHub Models compatible model
422+
Model: *h.options.Models.TestExpansion, // GitHub Models compatible model
416423
Messages: messages,
417424
Temperature: util.Ptr(0.5),
418425
}

cmd/generate/types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import "github.com/github/gh-models/pkg/prompt"
44

55
// PromptPexModelAliases represents model aliases for different purposes
66
type PromptPexModelAliases struct {
7-
Rules *string `yaml:"rules,omitempty" json:"rules,omitempty"`
8-
Tests *string `yaml:"tests,omitempty" json:"tests,omitempty"`
9-
Groundtruth *string `yaml:"groundtruth,omitempty" json:"groundtruth,omitempty"`
7+
Rules *string `yaml:"rules,omitempty" json:"rules,omitempty"`
8+
Tests *string `yaml:"tests,omitempty" json:"tests,omitempty"`
9+
Groundtruth *string `yaml:"groundtruth,omitempty" json:"groundtruth,omitempty"`
10+
TestExpansion *string `yaml:"testExpansion,omitempty" json:"testExpansion,omitempty"`
1011
}
1112

1213
// PromptPexPrompts contains custom prompts for different stages

0 commit comments

Comments
 (0)