@@ -171,6 +171,8 @@ def suggest_changes(
171171 replay_tests : str = "" ,
172172 concolic_tests : str = "" ,
173173 optimization_review : str = "" ,
174+ original_line_profiler : str | None = None ,
175+ optimized_line_profiler : str | None = None ,
174176) -> Response :
175177 """Suggest changes to a pull request.
176178
@@ -182,6 +184,8 @@ def suggest_changes(
182184 :param file_changes: A dictionary of file changes.
183185 :param pr_comment: The pull request comment object, containing the optimization explanation, best runtime, etc.
184186 :param generated_tests: The generated tests.
187+ :param original_line_profiler: Line profiler results for original code (markdown format).
188+ :param optimized_line_profiler: Line profiler results for optimized code (markdown format).
185189 :return: The response object.
186190 """
187191 payload = {
@@ -197,7 +201,10 @@ def suggest_changes(
197201 "replayTests" : replay_tests ,
198202 "concolicTests" : concolic_tests ,
199203 "optimizationReview" : optimization_review , # impact keyword left for legacy reasons, touches js/ts code
204+ "originalLineProfiler" : original_line_profiler ,
205+ "optimizedLineProfiler" : optimized_line_profiler ,
200206 }
207+
201208 return make_cfapi_request (endpoint = "/suggest-pr-changes" , method = "POST" , payload = payload )
202209
203210
@@ -214,6 +221,8 @@ def create_pr(
214221 replay_tests : str = "" ,
215222 concolic_tests : str = "" ,
216223 optimization_review : str = "" ,
224+ original_line_profiler : str | None = None ,
225+ optimized_line_profiler : str | None = None ,
217226) -> Response :
218227 """Create a pull request, targeting the specified branch. (usually 'main').
219228
@@ -223,6 +232,8 @@ def create_pr(
223232 :param file_changes: A dictionary of file changes.
224233 :param pr_comment: The pull request comment object, containing the optimization explanation, best runtime, etc.
225234 :param generated_tests: The generated tests.
235+ :param original_line_profiler: Line profiler results for original code (markdown format).
236+ :param optimized_line_profiler: Line profiler results for optimized code (markdown format).
226237 :return: The response object.
227238 """
228239 # convert Path objects to strings
@@ -239,7 +250,10 @@ def create_pr(
239250 "replayTests" : replay_tests ,
240251 "concolicTests" : concolic_tests ,
241252 "optimizationReview" : optimization_review , # Impact keyword left for legacy reasons, it touches js/ts codebase
253+ "originalLineProfiler" : original_line_profiler ,
254+ "optimizedLineProfiler" : optimized_line_profiler ,
242255 }
256+
243257 return make_cfapi_request (endpoint = "/create-pr" , method = "POST" , payload = payload )
244258
245259
@@ -269,6 +283,8 @@ def create_staging(
269283 concolic_tests : str ,
270284 root_dir : Path ,
271285 optimization_review : str = "" ,
286+ original_line_profiler : str | None = None ,
287+ optimized_line_profiler : str | None = None ,
272288) -> Response :
273289 """Create a staging pull request, targeting the specified branch. (usually 'staging').
274290
@@ -279,6 +295,8 @@ def create_staging(
279295 :param generated_original_test_source: Generated tests for the original function.
280296 :param function_trace_id: Unique identifier for this optimization trace.
281297 :param coverage_message: Coverage report or summary.
298+ :param original_line_profiler: Line profiler results for original code (markdown format).
299+ :param optimized_line_profiler: Line profiler results for optimized code (markdown format).
282300 :return: The response object from the backend.
283301 """
284302 relative_path = explanation .file_path .relative_to (root_dir ).as_posix ()
@@ -310,6 +328,8 @@ def create_staging(
310328 "replayTests" : replay_tests ,
311329 "concolicTests" : concolic_tests ,
312330 "optimizationReview" : optimization_review , # Impact keyword left for legacy reasons, it touches js/ts codebase
331+ "originalLineProfiler" : original_line_profiler ,
332+ "optimizedLineProfiler" : optimized_line_profiler ,
313333 }
314334
315335 return make_cfapi_request (endpoint = "/create-staging" , method = "POST" , payload = payload )
0 commit comments