-
Couldn't load subscription status.
- Fork 22
[FIX] log final explanation #668
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
Conversation
PR Reviewer Guide 🔍(Review updated until commit d3fed4e)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
Persistent review updated to latest commit d3fed4e |
PR Code Suggestions ✨No code suggestions found for the PR. |
| @dataclass | ||
| class OptimizedCandidate: | ||
| source_code: CodeStringsMarkdown | ||
| explanation: str |
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.
Q: why we arent having old explanation and new explanation as sep field here?
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.
i would propose to keep it frozen. we can instantiate a new candidate with the new explanation. we don't want to corrupt the existing data we have.
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.
LGTM
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.
@mohammedahmed18 have a look at explanations/explanations.py on the internal repo. we are already logging the explanation. We can preserve the original explanation. what you are suggesting will overwrite it on the db.
|
@aseembits93 it won’t override the original, since the explanation is overwritten only after creating the data dict (which still contains the original explanation). That said, I added |
|
|
||
| best_optimization.candidate.explanation = new_explanation | ||
|
|
||
| console.print(Panel(new_explanation_raw_str, title="Best Candidate Explanation", border_style="blue")) |
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.
print should remain there @mohammedahmed18
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.
@aseembits93
already printed here
1234| self.log_successful_optimization(new_explanation, generated_tests, exp_type)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.
sounds good @mohammedahmed18
User description
Before
After
PR Type
Bug fix, Enhancement
Description
Log only final candidate explanation
Remove
frozen=Truefrom OptimizedCandidateRemove console print of interim explanation
Assign new explanation to candidate
File Walkthrough
models.py
Make OptimizedCandidate mutablecodeflash/models/models.py
frozen=TruefromOptimizedCandidatefunction_optimizer.py
Log only final candidate explanationcodeflash/optimization/function_optimizer.py
log_successful_optimizationto use final explanationnew_explanationtocandidate.explanation