Skip to content

Commit d66d2ce

Browse files
small changes
1 parent 12dc7e1 commit d66d2ce

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

codeflash/api/aiservice.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,18 +321,17 @@ def optimize_python_code_repair(self, request: AIServiceCodeRepairRequest) -> Op
321321
return None
322322

323323
if response.status_code == 200:
324-
refined_optimization = response.json()
324+
fixed_optimization = response.json()
325325
console.rule()
326326

327-
refinements = self._get_valid_candidates([refined_optimization])
328-
if not refinements:
327+
if not self._get_valid_candidates([fixed_optimization]):
329328
logger.error("Code repair failed to generate a valid candidate.")
330329
return None
331330

332331
return OptimizedCandidate(
333-
source_code=refinements[0].source_code,
334-
explanation=refinements[0].explanation,
335-
optimization_id=refinements[0].optimization_id[:-4] + "cdrp",
332+
source_code=fixed_optimization["source_code"],
333+
explanation=fixed_optimization["explanation"],
334+
optimization_id=fixed_optimization["optimization_id"],
336335
)
337336

338337
try:

codeflash/optimization/function_optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ def run_optimized_candidate( # noqa: PLR0911
18921892

18931893
ai_service_client = self.aiservice_client if exp_type == "EXP0" else self.local_aiservice_client
18941894

1895-
with progress_bar("The test results are not matching, let me see if I can fix this"):
1895+
with progress_bar("Some of the test results are not matching, let me see if I can fix this"):
18961896
new_candidate = self.code_repair_optimizations(
18971897
original_source_code=code_context.read_writable_code.markdown,
18981898
modified_source_code=candidate.source_code.markdown,

0 commit comments

Comments
 (0)