-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRG] Fixed bugs of Kaggle integration #237
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b043ec4
🐛 fix: fixed the kaggle.json not found error
huangyz0918 4a263b1
🐛 fix: fixed the none type environments of kaggle integration
huangyz0918 f5f20c9
🐛 fix: fixed the kaggle login
huangyz0918 5c23b58
✨ feat: added `auto_kaggle` function
huangyz0918 1c9b58a
✨ feat: added `auto-kaggle` CLI
huangyz0918 8a7a51e
🚑 quickfix: fixed the code style
huangyz0918 04e6a4e
✨ feat: added submission checker
huangyz0918 5cd920d
🚑 quickfix: fixed the checker flag
huangyz0918 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,17 @@ def process_summary(summary_dict: dict): | |
|
||
class CodeAgent: | ||
|
||
def __init__(self, model, working_dir='.', console=None): | ||
def __init__(self, model, working_dir='.', console=None, single_file=False): | ||
""" | ||
CodeAgent: the agent to solve the given coding problems, by planning coding tasks, searching websites, | ||
and generating code snippets. It does not execute the code, only make use of built-in functions to provides | ||
the code snippets to solve the problem. | ||
|
||
Args: | ||
model: the model to use. | ||
working_dir: the working directory. | ||
console: the console to use. | ||
single_file: whether the agent is working on a single file or not. | ||
""" | ||
config_data = get_config() | ||
self.code_summary = None | ||
|
@@ -49,19 +52,37 @@ def __init__(self, model, working_dir='.', console=None): | |
|
||
Your can leverage your capabilities by using the specific functions listed below: | ||
|
||
1. Creating project structures based on the user requirement using function `create_directory`. | ||
2. Writing clean, efficient, and well-documented code using function `create_file` and `write_file`. | ||
3. Exam the project to re-use the existing code snippets as much as possible, you may need to use | ||
- Creating project structures based on the user requirement using function `create_directory`. | ||
- Writing clean, efficient, and well-documented code using function `create_file` and `write_file`. | ||
- Exam the project to re-use the existing code snippets as much as possible, you may need to use | ||
functions like `list_files`, `read_file` and `write_file`. | ||
4. Writing the code into the file when creating new files, do not create empty files. | ||
5. Use function `preview_csv_data` to preview the CSV data if the task include CSV data processing. | ||
6. Decide whether the task requires execution and debugging before moving to the next or not. | ||
7. Generate the commands to run and test the current task, and the dependencies list for this task. | ||
8. You only write Python scripts, don't write Jupiter notebooks which require interactive execution. | ||
- Writing the code into the file when creating new files, do not create empty files. | ||
- Use function `preview_csv_data` to preview the CSV data if the task include CSV data processing. | ||
- Decide whether the task requires execution and debugging before moving to the next or not. | ||
- Generate the commands to run and test the current task, and the dependencies list for this task. | ||
- You only write Python scripts, don't write Jupiter notebooks which require interactive execution. | ||
""" | ||
|
||
if single_file: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add a the 2 prompts here have many redundancies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure |
||
self.sys_prompt = f""" | ||
You are an expert programmer working on an Machine Learning task using Python. | ||
You are currently working on: {self.working_dir}. | ||
|
||
Your can leverage your capabilities by using the specific functions listed below: | ||
|
||
- You should create a single script first, with the complete code inside. You can have multiple functions and classes. | ||
- Writing clean, efficient, and well-documented code to a script using functions `create_file`. | ||
- Use function `preview_csv_data` to preview the CSV data if the task include CSV dataset or examples. | ||
- Generate the commands to run and test the current script, and the dependencies list required for this script. | ||
- You only write Python scripts, don't write Jupiter notebooks which require interactive execution. | ||
- Make sure the code has met the task description, and the suggested methods. | ||
- Make sure the output format and the output file path is correct. | ||
""" | ||
|
||
self.search_prompt = """ | ||
9. Performing web searches use function `web_search` to get up-to-date information or additional context. | ||
- Performing web searches use function `web_search` to get up-to-date information or additional context. | ||
""" | ||
|
||
self.json_mode_prompt = """ | ||
|
||
The output format should be in JSON format, include: | ||
|
@@ -86,6 +107,27 @@ def __init__(self, model, working_dir='.', console=None): | |
} | ||
|
||
""" | ||
|
||
if single_file: | ||
self.json_mode_prompt = """ | ||
|
||
The output format should be in JSON format, include: | ||
|
||
1. The dependency list that the project needs to run. | ||
2. And the command and the parameters to run and test the script. | ||
|
||
Example JSON output: | ||
|
||
{ | ||
"dependency":[ | ||
"torch", | ||
"scikit-learn" | ||
], | ||
"command":"python /path/to/your/project.py", | ||
} | ||
|
||
""" | ||
|
||
self.functions = [ | ||
schema_read_file, | ||
schema_create_file, | ||
|
@@ -122,7 +164,7 @@ def code(self, task_dict: dict): | |
""" | ||
task_prompt = textwrap.dedent(f""" | ||
You are required to complete task: {task_dict.get('task')}.\n | ||
You should: {task_dict.get('description')} | ||
Task description: {task_dict.get('description')} | ||
""") | ||
|
||
with self.console.status(f"Coder is working on the task: {task_dict.get('task')}..."): | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry. What does this process mean?
coud you give an e.g. in this function doc?
as
process the report
is too general for me