-
Notifications
You must be signed in to change notification settings - Fork 3
Add ProTeGi Prompt Optimizer #57
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
Open
DanielDango
wants to merge
49
commits into
ardoco:main
Choose a base branch
from
DanielDango:feature/add-protegi-optimization
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.
Open
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
dc7426a
feat: Add gradient optimizer based on ProTeGi by "Automatic Prompt Op…
DanielDango afc5741
feat: implement caching for OpenAI chat models to optimize performance
DanielDango 2adc722
feat: return intermediate results during prompt optimization
DanielDango 778d5f0
feat: encapsulate cache replacement strategies into enum
DanielDango aecfb43
Merge remote-tracking branch 'upstream/feature/add-prompt-optimizatio…
DanielDango 7fbcaac
Merge branch 'feature/add-prompt-optimization-module' into feature/ad…
DanielDango 52fb042
Merge remote-tracking branch 'upstream/feature/add-prompt-optimizatio…
DanielDango 279d7c3
Revert "revert: remove evaluator from config which is to be added wit…
DanielDango 35afddd
Revert "revert: Evaluator module only required for future gradient op…
DanielDango bedf3f1
refactor: fix package hierarchy
DanielDango 14e5f71
revert: remove CacheReplacementStrategy.java
DanielDango 23c2750
chore: pull recent changes into ProTeGi implementation
DanielDango 891081c
fix: rename logger
DanielDango bded850
Merge branch 'feature/add-prompt-optimization-module' into feature/ad…
DanielDango 678fae1
Merge remote-tracking branch 'origin/main' into feature/add-protegi-o…
dfuchss 8eabec5
Spotless applied
dfuchss 6523e69
Make chat language model provider lazy
dfuchss 05a5877
chore: update optimize methods to return lists of optimized prompts
DanielDango 6929d4b
fix: add docs and address APO issues
DanielDango 904d9dd
refactor: clarify evaluator module and rename to Selector
DanielDango fa8174a
chore: standardize configuration parameter names and improve document…
DanielDango 5093db3
refactor: replace maximum_iterations statistic regex replacement with…
DanielDango 271efd2
chore: extend configurable fields for the AutomaticPromptOptimizer
DanielDango d333c3e
refactor: rename AutomaticPromptOptimizer.java and GradientOptimizerC…
DanielDango 5564254
Apply suggestion from @dfuchss
dfuchss dc33542
Update src/main/java/edu/kit/kastel/sdq/lissa/ratlr/promptoptimizer/P…
dfuchss 7424af6
refactor: rename evaluator to selector in configuration and related f…
DanielDango e8b7a06
revert: remove e2e test for sample configs as the datasets are not pa…
DanielDango bc3c82f
refactor: access the config object directly instead of manipulating j…
DanielDango a282af2
refactor: pull SamplerFactory.java into SampleStrategy.java
DanielDango 4bf68ff
chore: various tweaks
DanielDango dff2a0c
revert: remove intermediate statistics as the config fields are not r…
DanielDango 9adb38f
Flip correct flag
dfuchss ee20a09
Merge remote-tracking branch 'origin/feature/add-protegi-optimization…
DanielDango df3b657
Merge remote-tracking branch 'upstream/main' into feature/add-protegi…
DanielDango cdd041b
refactor: remove unused import in EvaluationResult.java
DanielDango 5a47ebd
refactor: improve configuration validation in optimization classes, c…
DanielDango b90be13
Merge remote-tracking branch 'upstream/main' into feature/add-protegi…
DanielDango 786731f
refactor: make Selector in PromptOptimizer nullable and ensure proper…
DanielDango d7958fb
docs: enhance prompt optimization documentation for clarity and detail
DanielDango b3a081e
refactor: simplify Selectors by removing the development artifact moc…
DanielDango a3b68a3
feat: add support for new ChatRequestOptions in chat method
DanielDango 841f693
refactor: remove nullability from createSelector as mock selector was…
DanielDango c12a75a
docs: remove MockSelector references from documentation
DanielDango 541723d
Do not expose LazyChatModel
dfuchss 8c9650d
fix: address minor code review changes
DanielDango 1f2b78f
refactor: improve textual representation in EvaluationResult
DanielDango 46a9e27
refactor: rename variable for clarity and remove redundant test case
DanielDango 2d65f72
refactor: extract method to improve readability in UpperConfidenceBou…
DanielDango 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
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
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 |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
|
|
||
| { | ||
|
DanielDango marked this conversation as resolved.
|
||
| "cache_dir": "./cache/WARC", | ||
|
|
||
| "gold_standard_configuration": { | ||
| "path": "./datasets/req2req/WARC/answer.csv", | ||
| "hasHeader": "true" | ||
| }, | ||
|
|
||
| "source_artifact_provider" : { | ||
| "name" : "text", | ||
| "args" : { | ||
| "artifact_type" : "requirement", | ||
| "path" : "./datasets/req2req/WARC/high" | ||
| } | ||
| }, | ||
| "target_artifact_provider" : { | ||
| "name" : "text", | ||
| "args" : { | ||
| "artifact_type" : "requirement", | ||
| "path" : "./datasets/req2req/WARC/low" | ||
| } | ||
| }, | ||
| "source_preprocessor" : { | ||
| "name" : "artifact", | ||
| "args" : {} | ||
| }, | ||
| "target_preprocessor" : { | ||
| "name" : "artifact", | ||
| "args" : {} | ||
| }, | ||
| "embedding_creator" : { | ||
| "name" : "openai", | ||
| "args" : { | ||
| "model": "text-embedding-3-large" | ||
| } | ||
| }, | ||
| "source_store" : { | ||
| "name" : "custom", | ||
| "args" : {} | ||
| }, | ||
| "target_store" : { | ||
| "name" : "cosine_similarity", | ||
| "args" : { | ||
| "max_results" : 4 | ||
| } | ||
| }, | ||
| "metric" : { | ||
| "name" : "pointwise", | ||
| "args" : {} | ||
| }, | ||
| "selector" : { | ||
| "name" : "ucb", | ||
| "args" : { | ||
| "samples_per_eval" : 16 | ||
| } | ||
| }, | ||
| "prompt_optimizer": { | ||
| "name" : "gradient_openai", | ||
| "args" : { | ||
| "prompt": "Question: Here are two parts of software development artifacts.\n\n {source_type}: '''{source_content}'''\n\n {target_type}: '''{target_content}'''\n Are they related?\n\n Answer with 'yes' or 'no'.", | ||
| "model": "gpt-4o-mini-2024-07-18", | ||
| "maximum_iterations": 3, | ||
| "minibatch_size" : 20 | ||
| } | ||
|
DanielDango marked this conversation as resolved.
|
||
| }, | ||
| "classifier" : { | ||
| "name" : "simple_openai", | ||
| "args" : { | ||
| "model": "gpt-4o-mini-2024-07-18", | ||
| "temperature": 0.0 | ||
| } | ||
| }, | ||
| "result_aggregator" : { | ||
| "name" : "any_connection", | ||
| "args" : {} | ||
| }, | ||
| "tracelinkid_postprocessor" : { | ||
| "name" : "identity", | ||
| "args" : {} | ||
| } | ||
| } | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.