Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codeflash/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class TestsInFile:
test_type: TestType


@dataclass(frozen=True)
@dataclass
class OptimizedCandidate:
source_code: CodeStringsMarkdown
explanation: str
Copy link
Contributor

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?

Copy link
Contributor

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.

Expand Down
5 changes: 3 additions & 2 deletions codeflash/optimization/function_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ def find_and_process_best_optimization(
original_helper_code,
code_context,
)
self.log_successful_optimization(explanation, generated_tests, exp_type)
self.log_successful_optimization(best_optimization.candidate.explanation, generated_tests, exp_type)
return best_optimization

def process_review(
Expand Down Expand Up @@ -1232,7 +1232,8 @@ def process_review(
file_path=explanation.file_path,
benchmark_details=explanation.benchmark_details,
)
console.print(Panel(new_explanation_raw_str, title="Best Candidate Explanation", border_style="blue"))
Copy link
Contributor

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

Copy link
Contributor Author

@mohammedahmed18 mohammedahmed18 Aug 19, 2025

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good @mohammedahmed18

best_optimization.candidate.explanation = new_explanation

data = {
"original_code": original_code_combined,
"new_code": new_code_combined,
Expand Down
Loading