A helper function to construct the prompt. Read the code and the related information (e.g. stack_trace) from the a list of commits. Then feed into the prompt constructor. The operation_type is either "mutation" or "crossover". The prompt_constructor is a function with the following s
(config, prev_commit, new_commit)
| 578 | |
| 579 | |
| 580 | def _construct_diff_comp_prompt(config, prev_commit, new_commit) -> str: |
| 581 | """A helper function to construct the prompt. |
| 582 | Read the code and the related information (e.g. stack_trace) from the a list of commits. |
| 583 | Then feed into the prompt constructor. |
| 584 | The operation_type is either "mutation" or "crossover". |
| 585 | The prompt_constructor is a function with the following signature: |
| 586 | def prompt_constructor(operation_type: str, code_infos: List[CodeInfo]) -> str |
| 587 | """ |
| 588 | diff = git.diff_view(config, prev_commit, new_commit) |
| 589 | prev_file_list = git.list_files(config, prev_commit) |
| 590 | prev_info = git.read_note(config, prev_commit) |
| 591 | new_info = git.read_note(config, new_commit) |
| 592 | prompt = config.diff_prompt_constructor(prev_file_list, diff, prev_info, new_info) |
| 593 | return prompt |
| 594 | |
| 595 | |
| 596 | def llm_diff_compare( |