Skip to content

Commit 497da46

Browse files
committed
send codeflash cli version to backend for backwards compatibility
1 parent 7a0554f commit 497da46

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

codeflash/api/aiservice.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from codeflash.models.ExperimentMetadata import ExperimentMetadata
2222
from codeflash.models.models import AIServiceRefinerRequest, CodeStringsMarkdown, OptimizedCandidate
2323
from codeflash.telemetry.posthog_cf import ph
24+
from codeflash.version import __version__
2425
from codeflash.version import __version__ as codeflash_version
2526

2627
if 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:

codeflash/optimization/function_optimizer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
from codeflash.verification.test_runner import run_behavioral_tests, run_benchmarking_tests, run_line_profile_tests
102102
from codeflash.verification.verification_utils import get_test_file_path
103103
from codeflash.verification.verifier import generate_tests
104+
from codeflash.version import __version__
104105

105106
if TYPE_CHECKING:
106107
from argparse import Namespace
@@ -1427,6 +1428,7 @@ def process_review(
14271428
original_throughput=original_throughput_str,
14281429
optimized_throughput=optimized_throughput_str,
14291430
throughput_improvement=throughput_improvement_str,
1431+
codeflash_version=__version__,
14301432
)
14311433
new_explanation = Explanation(
14321434
raw_explanation_message=new_explanation_raw_str or explanation.raw_explanation_message,

0 commit comments

Comments
 (0)