Skip to content

Commit 5ed5dfc

Browse files
author
Codeflash Bot
committed
works, figure out logging
1 parent 8a28d0d commit 5ed5dfc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

codeflash/api/aiservice.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ def optimize_python_code_repair(self, request: list[AIServiceCodeRepairRequest])
310310
"optimization_id": opt.optimization_id,
311311
"original_source_code": opt.original_source_code,
312312
"modified_source_code": opt.modified_source_code,
313+
"test_details": opt.test_details,
313314
"trace_id": opt.trace_id,
314315
}
315316
for opt in request
@@ -325,7 +326,7 @@ def optimize_python_code_repair(self, request: list[AIServiceCodeRepairRequest])
325326

326327
if response.status_code == 200:
327328
refined_optimizations = response.json()["code_repairs"]
328-
logger.debug(f"Generated {len(refined_optimizations)} candidate refinements.")
329+
# logger.debug(f"Generated {len(refined_optimizations)} candidate refinements.")
329330
console.rule()
330331

331332
refinements = self._get_valid_candidates(refined_optimizations)

codeflash/optimization/function_optimizer.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -593,24 +593,22 @@ def determine_best_candidate(
593593
speedup_ratios[candidate.optimization_id] = None
594594
fail_value = run_results.value
595595
if (
596-
fail_value != "Test results did not match the test results of the original code."
596+
fail_value.strip() != "Test results did not match the test results of the original code."
597597
and len(future_all_refinements) <= 3
598598
and not candidate.optimization_id.endswith("cdrp")
599599
):
600600
# # queue corresponding code repair optimization for best optimization
601601
future_all_refinements.append(
602602
self.code_repair_optimizations(
603-
original_source_code=candidate,
604-
modified_source_code=code_context,
605-
original_code_baseline=original_code_baseline,
606-
test_details="test_details",
607-
code_context=code_context,
603+
original_source_code=code_context.read_writable_code.markdown,
604+
modified_source_code=candidate.source_code.markdown,
605+
test_details=fail_value,
608606
trace_id=self.function_trace_id[:-4] + exp_type
609607
if self.experiment_id
610608
else self.function_trace_id,
611609
ai_service_client=ai_service_client,
612610
executor=self.executor,
613-
function_references=function_references,
611+
optimization_id=candidate.optimization_id,
614612
)
615613
)
616614
else:
@@ -869,12 +867,13 @@ def code_repair_optimizations(
869867
modified_source_code: str,
870868
test_details: str,
871869
trace_id: str,
870+
optimization_id: str,
872871
ai_service_client: AiServiceClient,
873872
executor: concurrent.futures.ThreadPoolExecutor,
874873
) -> concurrent.futures.Future:
875874
request = [
876875
AIServiceCodeRepairRequest(
877-
optimization_id="",
876+
optimization_id=optimization_id,
878877
original_source_code=original_source_code,
879878
modified_source_code=modified_source_code,
880879
test_details=test_details,

0 commit comments

Comments
 (0)