-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add json only llm call * lint * save * update * update * bump to dev2 * retype * update * update steps * update modify code to create as well * updates * Add PRPB * add PRPB * remove readme * changes * fix small bugs * save * update * bump and fix * Allow PRPB to accept path and dict, Add type to CallCode2Prompt outputs * SimplifidedLLMPB change variable * add again * some linting * Patched /home/runner/work/patchwork/patchwork/patchwork/steps/FilterBySimilarity/README.md (#679) Co-authored-by: patched.codes[bot] <298395+patched.codes[bot]@users.noreply.github.com> * fix circular import * changes * fix test case --------- Co-authored-by: Asankhaya Sharma <[email protected]> Co-authored-by: Patched <[email protected]> Co-authored-by: patched.codes[bot] <298395+patched.codes[bot]@users.noreply.github.com>
- Loading branch information
1 parent
032dc27
commit b6fbfbf
Showing
31 changed files
with
642 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
TOKEN_URL = "https://app.patched.codes/signin" | ||
DEFAULT_PATCH_URL = "https://patchwork.patched.codes/v1" | ||
PROMPT_TEMPLATE_FILE_KEY = "prompt_template_file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Input and Output Data Handling for FilterBySimilarity Step | ||
|
||
This documentation provides an overview of the content and structure of three Python files related to a step called `FilterBySimilarity` within a larger system (possibly an ML pipeline). | ||
|
||
### Inputs | ||
- `FilterBySimilarityInputs` class defines the expected input structure for the step, including: | ||
- `list`: A list of dictionaries. | ||
- `keywords`: A string annotated as configuration data. | ||
- `keys`: A string annotated as configuration data. | ||
- `top_k`: An integer annotated as configuration data. | ||
|
||
### Outputs | ||
- `FilterBySimilarityOutputs` class defines the output structure for the step, including: | ||
- `result_list`: A list of dictionaries containing filtered items based on similarity. | ||
|
||
### Code Functionality | ||
- The code within `FilterBySimilarity.py` file implements the logic for the `FilterBySimilarity` step. | ||
- It utilizes TF-IDF vectorization and cosine similarity to calculate the similarity between provided keywords and text items in the input list of dictionaries. | ||
- The step function processes the input data, calculates similarity scores, and returns a filtered list of items based on similarity. | ||
- A logger and several helper functions are used for processing input data and performing necessary calculations. | ||
- The file `__init__.py` is empty, serving as an initialization file for the package but does not contain any code logic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from patchwork.step import Step | ||
from patchwork.steps import PR | ||
from patchwork.steps.PRPB.typed import PRPBInputs, PRPBOutputs | ||
|
||
|
||
class PRPB(Step, input_class=PRPBInputs, output_class=PRPBOutputs): | ||
def __init__(self, inputs): | ||
super().__init__(inputs) | ||
key_map = dict(path=inputs["path_key"]) | ||
if inputs.get("title_key") is not None: | ||
key_map["commit_message"] = inputs["comment_title_key"] | ||
if inputs.get("message_key") is not None: | ||
key_map["patch_message"] = inputs["comment_message_key"] | ||
|
||
self.modified_files = [] | ||
input_modified_files = inputs.get("modified_files") | ||
if isinstance(input_modified_files, list): | ||
for modified_file in input_modified_files: | ||
converted_modified_file = {key: modified_file.get(mapped_key) for key, mapped_key in key_map.items()} | ||
self.modified_files.append(converted_modified_file) | ||
elif isinstance(input_modified_files, dict): | ||
converted_modified_file = {key: input_modified_files.get(mapped_key) for key, mapped_key in key_map.items()} | ||
self.modified_files.append(converted_modified_file) | ||
elif isinstance(input_modified_files, str): | ||
converted_modified_file = {"path": input_modified_files} | ||
self.modified_files.append(converted_modified_file) | ||
self.inputs = inputs | ||
|
||
def run(self): | ||
pr = PR({**self.inputs, "modified_code_files": self.modified_files}) | ||
pr_outputs = pr.run() | ||
|
||
return pr_outputs |
Empty file.
Oops, something went wrong.