-
Notifications
You must be signed in to change notification settings - Fork 14
generate command #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
pelikhan
wants to merge
128
commits into
main
Choose a base branch
from
pelikhan/promptpex
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
generate command #79
Changes from 1 commit
Commits
Show all changes
128 commits
Select commit
Hold shift + click to select a range
871788d
plumbing for commands
pelikhan 9e82844
bringing promptpex
pelikhan d8fcb9d
Add comprehensive Copilot instructions for AI coding agents
pelikhan 35870b9
Add unit tests for utility functions in generate package
pelikhan 3ea7a6e
Enhance ApplyEffortConfiguration to handle nil options gracefully
pelikhan ef7d089
Refactor PromptPexContext to use ChatMessage from azuremodels and rem…
pelikhan 96f9183
Implement GitHub Models evaluation file generation and enhance Prompt…
pelikhan 37b761c
Fix dereferencing of Frontmatter fields in GitHub Models prompt gener…
pelikhan 74d048b
Refactor model parameters handling in export.go and add comprehensive…
pelikhan 61a43ca
feat: Implement PromptPex command handler with pipeline execution
pelikhan ee90766
clea content
pelikhan e7d4a17
Add comprehensive tests for prompt generation and context creation
pelikhan 1c936c0
refactor: Remove obsolete export_test_new.go file
pelikhan 292917a
refactor: Remove obsolete output options and related tests from Promp…
pelikhan e9c6668
feat: Add GenerateSummary function and corresponding tests for prompt…
pelikhan 5c5a167
feat: Implement runPipeline function and refactor GenerateSummary for…
pelikhan b4b662f
refactor: Rename parseTestsFromLLMResponse to ParseTestsFromLLMRespon…
pelikhan 393020f
test: Add comprehensive tests for ParseTestsFromLLMResponse function …
pelikhan 6458590
feat: Implement generate command with comprehensive options and add s…
pelikhan cdc38f1
refactor: Consolidate command-line flag definitions into AddCommandLi…
pelikhan bbdd748
test: Add comprehensive tests for NewGenerateCommand and flag parsing…
pelikhan 7dc3d7d
test: Enhance TestGenerateCommandWithValidPromptFile with detailed mo…
pelikhan e812aec
move test to common fodler
pelikhan 341442f
feat: Update generate command description to include evaluations for …
pelikhan da294e2
fix: Clarify command description to specify the use of PromptPex meth…
pelikhan 50b853f
fix: Update build instructions to include 'make build' command
pelikhan 5018380
refactor: Rename runPipeline to RunTestGenerationPipeline and add Ren…
pelikhan 9391f0d
Merge remote-tracking branch 'origin/main' into pelikhan/promptpex
pelikhan f3f320b
refactor: Update test prompt from sentiment analysis to joke analysis
pelikhan 7ab63bc
fix: Disable usage help for pipeline failures in generate command
pelikhan f726d7c
feat: Add verbose flag for detailed output and update test prompts
pelikhan e5dd291
refactor: Remove logging functions and implement callModelWithRetry f…
pelikhan 239eed7
fix: Remove unnecessary blank line in callModelWithRetry function
pelikhan 1a9c9ab
feat: Add LLM connection test to RunTestGenerationPipeline
pelikhan e0f0311
Refactor pointer creation to use util.Ptr for consistency
pelikhan 26f6ee3
refactor: Update PromptPexOptions to use pointers for consistency acr…
pelikhan c6da6de
add logging
pelikhan 0a15cec
fix incorrect check for completions
pelikhan 130bc53
refactor: Remove LLM connection test from RunTestGenerationPipeline
pelikhan 06a9caa
refactor: Improve output formatting in GenerateSummary for better rea…
pelikhan e6f4173
Initial plan
Copilot 59fad69
Update interface and all calls to support HTTP logging filename param…
Copilot fca40f4
Add tests for HTTP logging filename feature and remove DEBUG env var …
Copilot a46680e
Refactor HTTP log to use Context instead of function parameters
Copilot 3cdc67e
Group HTTP log writes into single fprintf call for better performance
Copilot d19f533
Remove test files as requested
Copilot 7903afa
Update internal/azuremodels/azure_client.go
pelikhan 6dda3c5
Add --http-log CLI flag to replace DEBUG environment variable for HTT…
pelikhan 26df5e4
Remove redundant log formatting line in GetChatCompletionStream method
pelikhan f797a5a
Refactor PromptPexContext by removing WriteResults field and update r…
pelikhan 9e8a469
Update http-log flag description for clarity and adjust log formattin…
pelikhan cbf9d78
Remove http-log flag from eval and run commands; reset log file in Wi…
pelikhan 1ac704e
Rename CreateContext to CreateContextFromPrompt for clarity and updat…
pelikhan 34d55a2
Remove RateTests option and related logic from PromptPexOptions and c…
pelikhan 2d7ef3f
Refactor PromptPexOptions and PromptPexContext by removing unused fie…
pelikhan 582c004
Remove SplitRules field from EffortConfiguration and related tests fo…
pelikhan ba24a7a
Update copilot instructions for clarity and organization; enhance pro…
pelikhan 3b99ef5
Add PromptHash to PromptPexContext and implement hash computation for…
pelikhan 527b564
Implement ComputePromptHash function and update context handling; enh…
pelikhan 440914f
Refactor PromptPexOptions and related structures to consolidate model…
pelikhan 9e1c074
Refactor context creation to enhance clarity; update model handling i…
pelikhan d3b430a
Implement ParseRules function to clean up rules text; add tests for I…
pelikhan fce67b8
Refactor rules handling in tests to remove leading/trailing whitespac…
pelikhan e2c28d3
Refactor InverseRules to use a slice instead of a string; update rela…
pelikhan f183206
Refactor context and test handling to unify naming conventions; repla…
pelikhan f5bc450
Remove context_test.go file to streamline test suite and eliminate ob…
pelikhan 97a945f
Refactor PromptPexOptions and related tests to remove evals and model…
pelikhan 6f22c37
Refactor PromptPexOptions and related configurations to remove Compli…
pelikhan 4e17f45
Remove Compliance field from default options tests to align with rece…
pelikhan 1d06bed
Remove Compliance field from EffortConfiguration and related types; u…
pelikhan 2192d9e
Add TestExpansion field to PromptPexModelAliases; update related func…
pelikhan 12e866e
Refactor PromptPexContext to use pointers for RunID, PromptHash, Inte…
pelikhan 7ca45de
Enhance context creation by adding session file support; implement lo…
pelikhan d3d51c6
Add session file support to context creation; implement context loadi…
pelikhan fa86243
Update .gitignore to include generate.json files; remove test_generat…
pelikhan 4632732
Refactor CreateContextFromPrompt to remove sessionFile parameter; upd…
pelikhan b083161
Refactor output logging to use box formatting; enhance intent, input …
pelikhan 28f5a44
Move box formatting constants to the top of render.go for better visi…
pelikhan 0fe3ff6
Refactor context merging logic for improved readability; add system p…
pelikhan 4a55194
Add UnBacket and UnXml functions; update ParseRules and add tests for…
pelikhan ded2220
Refactor output rule and inverse rule rendering to use WriteEndListBo…
pelikhan 3aadaa3
Refactor regex patterns in ParseRules for improved accuracy; remove o…
pelikhan cbbccc2
Enhance session file handling in CreateContextFromPrompt; improve err…
pelikhan 9469f8c
Refactor generateTests function to simplify empty tests check; add gu…
pelikhan df5d94b
Refactor output rule and test generation messages for improved clarit…
pelikhan 3bb8a18
Refactor runSingleTestWithContext to simplify message handling; repla…
pelikhan 52eed37
Refactor runSingleTestWithContext and rendering functions for improve…
pelikhan 39249c3
Save context after generating groundtruth in generateGroundtruth func…
pelikhan d79901a
Update .gitignore to include all generate.json files in subdirectories
pelikhan b1b4f24
Refactor CreateContextFromPrompt to use handler's promptFile; add Sav…
pelikhan fc6800d
usebuiltin templating
pelikhan 507ec74
Refactor RunTestGenerationPipeline to handle context saving errors; s…
pelikhan e668ba8
Refactor effort configuration and remove test expansions; update comm…
pelikhan 8e5d8f8
Remove unused command-line flags for tests and verbosity from generat…
pelikhan 23ab2d7
render reasoning and ground truth
pelikhan 39f24ea
Refactor context handling in CreateContextFromPrompt; streamline sess…
pelikhan af399ab
Refactor output rendering; replace WriteToOut calls with WriteToParag…
pelikhan 98146ad
Enhance session file handling in CreateContextFromPrompt; update logg…
pelikhan d719935
Fix session file checks in CreateContextFromPrompt and SaveContext to…
pelikhan 5127d94
Refactor WriteStartBox method to accept a subtitle parameter for impr…
pelikhan f57bf34
Refactor groundtruth model handling and update command-line flag desc…
pelikhan eba1adc
wire up ci-lint
pelikhan 2d031ec
Update command examples in NewGenerateCommand for consistency and acc…
pelikhan 8b12281
Refactor PromptPex model aliases and remove unused TestExpansion fiel…
pelikhan 9eb7803
Refactor EffortConfiguration and PromptPexOptions by removing TestGen…
pelikhan 025e32e
Refactor PromptPex model handling by changing pointer fields to value…
pelikhan 7571825
Refactor PromptPexTest struct by changing pointer fields to values; u…
pelikhan 0615664
Refactor PromptPexContext by changing RunID and PromptHash fields to …
pelikhan 178d921
Refactor PromptPexOptions and related logic by changing pointer field…
pelikhan 59ca252
Refactor test_generate.yml by nesting temperature under modelParamete…
pelikhan 2831dd9
Fix JSON field names in PromptPexTest and test generation output for …
pelikhan a0cda99
Add model key parsing in callModelWithRetry for improved error handling
pelikhan d4a8976
Add IntentMaxTokens and InputSpecMaxTokens to PromptPexOptions; updat…
pelikhan 2018522
Add support for custom instructions in generation phases; update flag…
pelikhan e9adb0f
Add test generation feature using PromptPex methodology; include adva…
pelikhan 7defd59
Enhance README.md with detailed explanation of Inverse Output Rules a…
pelikhan 29074f6
Add Intent node to PromptPex mermaid diagram for clarity in output rules
pelikhan c058406
Refactor command-line flags and update test generation examples for c…
pelikhan 5bc1b87
Refactor test input handling in ParseTestsFromLLMResponse and update …
pelikhan 36fd696
Validate effort level in ParseFlags and add comprehensive tests for v…
pelikhan 4a3285e
Add evaluator rules compliance functionality and update related struc…
pelikhan 9c13267
Refactor effort configuration structure and update related logic for …
pelikhan 4b18ed0
Update Makefile to use correct path for Go linter; enhance error hand…
pelikhan 45d8915
add pull request description script
pelikhan 8f7da6c
Update cmd/generate/parser.go
pelikhan 376135e
Update cmd/generate/generate.go
pelikhan 1a6090e
Update cmd/generate/README.md
pelikhan d21cd6c
Remove test data from test_generate.yml to streamline example usage
pelikhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor: Remove LLM connection test from RunTestGenerationPipeline
- Loading branch information
commit 130bc536881742a190303f90f123304ae0773073
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |||
"strings" | ||||
"time" | ||||
|
||||
"github.com/briandowns/spinner" | ||||
"github.com/github/gh-models/internal/azuremodels" | ||||
) | ||||
|
||||
|
@@ -18,6 +19,11 @@ func (h *generateCommandHandler) callModelWithRetry(step string, req azuremodels | |||
h.logLLMRequest(step, req) | ||||
|
||||
for attempt := 0; attempt <= maxRetries; attempt++ { | ||||
sp := spinner.New(spinner.CharSets[14], 100*time.Millisecond, spinner.WithWriter(h.cfg.ErrOut)) | ||||
sp.Start() | ||||
//nolint:gocritic,revive // TODO | ||||
defer sp.Stop() | ||||
|
||||
resp, err := h.client.GetChatCompletionStream(ctx, req, h.org) | ||||
if err != nil { | ||||
var rateLimitErr *azuremodels.RateLimitError | ||||
|
@@ -39,10 +45,13 @@ func (h *generateCommandHandler) callModelWithRetry(step string, req azuremodels | |||
// For non-rate-limit errors, return immediately | ||||
return "", err | ||||
} | ||||
reader := resp.Reader | ||||
//nolint:gocritic,revive // TODO | ||||
defer reader.Close() | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the spinner issue, the defer statement for reader.Close() is inside a loop and may not behave as expected. Consider explicit resource management.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||
|
||||
var content strings.Builder | ||||
for { | ||||
completion, err := resp.Reader.Read() | ||||
completion, err := reader.Read() | ||||
if err != nil { | ||||
if errors.Is(err, context.Canceled) || strings.Contains(err.Error(), "EOF") { | ||||
break | ||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The defer statement for sp.Stop() is placed inside a loop and will be executed when the function returns, not when the loop iteration ends. This could lead to multiple spinners running simultaneously. Consider calling sp.Stop() explicitly before continuing to the next iteration or restructuring the code.
Copilot uses AI. Check for mistakes.