2121from codeflash .models .ExperimentMetadata import ExperimentMetadata
2222from codeflash .models .models import AIServiceRefinerRequest , CodeStringsMarkdown , OptimizedCandidate
2323from codeflash .telemetry .posthog_cf import ph
24+ from codeflash .version import __version__
2425from codeflash .version import __version__ as codeflash_version
2526
2627if TYPE_CHECKING :
@@ -308,6 +309,7 @@ def get_new_explanation( # noqa: D417
308309 original_throughput : str | None = None ,
309310 optimized_throughput : str | None = None ,
310311 throughput_improvement : str | None = None ,
312+ codeflash_version : str | None = "0.17.2" ,
311313 ) -> str :
312314 """Optimize the given python code for performance by making a request to the Django endpoint.
313315
@@ -327,6 +329,7 @@ def get_new_explanation( # noqa: D417
327329 - original_throughput: str | None - throughput for the baseline code (operations per second)
328330 - optimized_throughput: str | None - throughput for the optimized code (operations per second)
329331 - throughput_improvement: str | None - throughput improvement percentage
332+ - current codeflash version
330333
331334 Returns
332335 -------
@@ -349,6 +352,7 @@ def get_new_explanation( # noqa: D417
349352 "original_throughput" : original_throughput ,
350353 "optimized_throughput" : optimized_throughput ,
351354 "throughput_improvement" : throughput_improvement ,
355+ "codeflash_version" : codeflash_version ,
352356 }
353357 logger .info ("loading|Generating explanation" )
354358 console .rule ()
@@ -591,6 +595,7 @@ def get_optimization_impact(
591595 "benchmark_details" : explanation .benchmark_details if explanation .benchmark_details else None ,
592596 "optimized_runtime" : humanize_runtime (explanation .best_runtime_ns ),
593597 "original_runtime" : humanize_runtime (explanation .original_runtime_ns ),
598+ "codeflash_version" : __version__ ,
594599 }
595600 console .rule ()
596601 try :
0 commit comments