chore: move prompts to own file#117
Open
andrewklatzke wants to merge 2 commits intoaklatzke/AIC-1990/optimize-methodfrom
Open
chore: move prompts to own file#117andrewklatzke wants to merge 2 commits intoaklatzke/AIC-1990/optimize-methodfrom
andrewklatzke wants to merge 2 commits intoaklatzke/AIC-1990/optimize-methodfrom
Conversation
jsonbailey
approved these changes
Mar 31, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| "The improved configuration MUST produce responses that satisfy ALL of the following criteria.", | ||
| "These criteria are non-negotiable — every generated variation will be evaluated against them.", | ||
| "All variables must be used in the new instructions." | ||
| "", |
There was a problem hiding this comment.
Acceptance prompt line concatenation mistake
Low Severity
In variation_prompt_acceptance_criteria, two adjacent string literals are missing a comma, so Python concatenates them. This drops the intended separation before the criteria list in prompts.py, changing the generated prompt structure unexpectedly and making the acceptance section less clearly delimited.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Requirements
Describe the solution you've provided
Moves the prompts from the client.py -> prompts.py file. This is just logically breaking up the class and removing things that can be pulled out. This removes ~400 lines from client.py.
Additionally just adds an additional message to the failure error with the response length (seeing some failures where OpenAI is returning an empty response and this is valuable debug info). There was also a small prompt tweak in the tools section to help ameliorate this error.
Describe alternatives you've considered
I went down the route of implementing via
string.Templatewith multi line strings but ran into the following:joinapproachf"""would work, but require additional escaping for the literal variables, (ie{{id}}needs to become{{{{id}}}}pycodestyle) does not have a standard for file-level or block-level ignoresAdditional context
@jsonbailey and I talked about splitting this up while reviewing the PR
Note
Medium Risk
Mostly a refactor, but it changes the exact prompt strings used for judging and variation generation, which can affect optimization behavior and LLM output stability.
Overview
Moves prompt-building logic out of
OptimizationClientinto a newldai_optimization/prompts.pymodule, and updates the client/tests to call these shared helpers for message history, reasoning history, and variation prompt generation.Also tweaks prompt formatting (e.g., explicit
System:/Evaluation history:sections and stronger tool-return instructions) and improves variation structured-output parse failures by including the response length in the thrownValueError.Written by Cursor Bugbot for commit ea43575. This will update automatically on new commits. Configure here.