Skip to content

Commit d3fed4e

Browse files
fix: show final explanation only
1 parent 9bc32ea commit d3fed4e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

codeflash/models/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ class TestsInFile:
343343
test_type: TestType
344344

345345

346-
@dataclass(frozen=True)
346+
@dataclass
347347
class OptimizedCandidate:
348348
source_code: CodeStringsMarkdown
349349
explanation: str

codeflash/optimization/function_optimizer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ def find_and_process_best_optimization(
11581158
original_helper_code,
11591159
code_context,
11601160
)
1161-
self.log_successful_optimization(explanation, generated_tests, exp_type)
1161+
self.log_successful_optimization(best_optimization.candidate.explanation, generated_tests, exp_type)
11621162
return best_optimization
11631163

11641164
def process_review(
@@ -1232,7 +1232,8 @@ def process_review(
12321232
file_path=explanation.file_path,
12331233
benchmark_details=explanation.benchmark_details,
12341234
)
1235-
console.print(Panel(new_explanation_raw_str, title="Best Candidate Explanation", border_style="blue"))
1235+
best_optimization.candidate.explanation = new_explanation
1236+
12361237
data = {
12371238
"original_code": original_code_combined,
12381239
"new_code": new_code_combined,

0 commit comments

Comments
 (0)