@@ -171,6 +171,8 @@ def suggest_changes(
171171 replay_tests : str = "" ,
172172 concolic_tests : str = "" ,
173173 optimization_review : str = "" ,
174+ original_line_profiler : str = "" ,
175+ optimized_line_profiler : str = "" ,
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 = {
@@ -198,6 +202,13 @@ def suggest_changes(
198202 "concolicTests" : concolic_tests ,
199203 "optimizationReview" : optimization_review , # impact keyword left for legacy reasons, touches js/ts code
200204 }
205+
206+ # Add line profiler data if available
207+ if original_line_profiler :
208+ payload ["originalLineProfiler" ] = original_line_profiler
209+ if optimized_line_profiler :
210+ payload ["optimizedLineProfiler" ] = optimized_line_profiler
211+
201212 return make_cfapi_request (endpoint = "/suggest-pr-changes" , method = "POST" , payload = payload )
202213
203214
@@ -214,6 +225,8 @@ def create_pr(
214225 replay_tests : str = "" ,
215226 concolic_tests : str = "" ,
216227 optimization_review : str = "" ,
228+ original_line_profiler : str = "" ,
229+ optimized_line_profiler : str = "" ,
217230) -> Response :
218231 """Create a pull request, targeting the specified branch. (usually 'main').
219232
@@ -223,6 +236,8 @@ def create_pr(
223236 :param file_changes: A dictionary of file changes.
224237 :param pr_comment: The pull request comment object, containing the optimization explanation, best runtime, etc.
225238 :param generated_tests: The generated tests.
239+ :param original_line_profiler: Line profiler results for original code (markdown format).
240+ :param optimized_line_profiler: Line profiler results for optimized code (markdown format).
226241 :return: The response object.
227242 """
228243 # convert Path objects to strings
@@ -240,6 +255,13 @@ def create_pr(
240255 "concolicTests" : concolic_tests ,
241256 "optimizationReview" : optimization_review , # Impact keyword left for legacy reasons, it touches js/ts codebase
242257 }
258+
259+ # Add line profiler data if available
260+ if original_line_profiler :
261+ payload ["originalLineProfiler" ] = original_line_profiler
262+ if optimized_line_profiler :
263+ payload ["optimizedLineProfiler" ] = optimized_line_profiler
264+
243265 return make_cfapi_request (endpoint = "/create-pr" , method = "POST" , payload = payload )
244266
245267
@@ -269,6 +291,8 @@ def create_staging(
269291 concolic_tests : str ,
270292 root_dir : Path ,
271293 optimization_review : str = "" ,
294+ original_line_profiler : str = "" ,
295+ optimized_line_profiler : str = "" ,
272296) -> Response :
273297 """Create a staging pull request, targeting the specified branch. (usually 'staging').
274298
@@ -279,6 +303,8 @@ def create_staging(
279303 :param generated_original_test_source: Generated tests for the original function.
280304 :param function_trace_id: Unique identifier for this optimization trace.
281305 :param coverage_message: Coverage report or summary.
306+ :param original_line_profiler: Line profiler results for original code (markdown format).
307+ :param optimized_line_profiler: Line profiler results for optimized code (markdown format).
282308 :return: The response object from the backend.
283309 """
284310 relative_path = explanation .file_path .relative_to (root_dir ).as_posix ()
@@ -312,6 +338,12 @@ def create_staging(
312338 "optimizationReview" : optimization_review , # Impact keyword left for legacy reasons, it touches js/ts codebase
313339 }
314340
341+ # Add line profiler data if available
342+ if original_line_profiler :
343+ payload ["originalLineProfiler" ] = original_line_profiler
344+ if optimized_line_profiler :
345+ payload ["optimizedLineProfiler" ] = optimized_line_profiler
346+
315347 return make_cfapi_request (endpoint = "/create-staging" , method = "POST" , payload = payload )
316348
317349
0 commit comments