Skip to content

Commit

Permalink
Update create_file agent skill (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj authored Aug 15, 2024
1 parent f4b241c commit 398fd92
Show file tree
Hide file tree
Showing 33 changed files with 70 additions and 77 deletions.
15 changes: 7 additions & 8 deletions opendevin/runtime/plugins/agent_skills/agentskills.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
- goto_line(line_number): Moves the window to show the specified line number.
- scroll_down(): Moves the window down by the number of lines specified in WINDOW.
- scroll_up(): Moves the window up by the number of lines specified in WINDOW.
- create_file(filename): Creates and opens a new file with the given name.
- search_dir(search_term, dir_path='./'): Searches for a term in all files in the specified directory.
- search_file(search_term, file_path=None): Searches for a term in the specified file or the currently open file.
- find_file(file_name, dir_path='./'): Finds all files with the given name in the specified directory.
- create_file(filename): Creates a file with the given name.
- edit_file_by_replace(file_name: str, to_replace: str, new_content: str): Replaces lines in a file with the given content.
- insert_content_at_line(file_name: str, line_number: int, content: str): Inserts given content at the specified line number in a file.
- append_file(file_name: str, content: str): Appends the given content to the end of the specified file.
Expand Down Expand Up @@ -285,19 +285,18 @@ def scroll_up() -> None:


def create_file(filename: str) -> None:
"""Creates and opens a new file with the given name.
"""Creates a file with the given name.
Args:
filename: str: The name of the file to create.
"""
if os.path.exists(filename):
raise FileExistsError(f"File '{filename}' already exists.")

with open(filename, 'w') as file:
file.write('\n')
print(f"File '{filename}' already exists.")
else:
with open(filename, 'w') as file:
file.write('\n')

open_file(filename)
print(f'[File {filename} created.]')
print(f'[File {filename} created.]')


LINTER_ERROR_MSG = '[Your proposed edit has introduced new syntax error(s). Please understand the errors and retry your edit command.]\n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down Expand Up @@ -408,9 +408,9 @@ find_file('bad.txt')
----------

OBSERVATION:
[Found 1 matches for "bad.txt" in ./]
./bad.txt
[End of matches for "bad.txt" in ./]
[Found 1 matches for "bad.txt" in ./]
./bad.txt
[End of matches for "bad.txt" in ./]


----------
Expand All @@ -423,13 +423,13 @@ open_file('/workspace/bad.txt')
----------

OBSERVATION:
[File: /workspace/bad.txt (4 lines total)]
(this is the beginning of the file)
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
(this is the end of the file)
[File: /workspace/bad.txt (4 lines total)]
(this is the beginning of the file)
1|This is a stupid typoo.
2|Really?
3|No mor typos!
4|Enjoy!
(this is the end of the file)


----------
Expand All @@ -451,14 +451,14 @@ edit_file_by_replace(
----------

OBSERVATION:
[File: /workspace/bad.txt (4 lines total after edit)]
(this is the beginning of the file)
1|This is a stupid typo.
2|Really?
3|No mor typos!
4|Enjoy!
(this is the end of the file)
[File updated (edited at line 1). Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
[File: /workspace/bad.txt (4 lines total after edit)]
(this is the beginning of the file)
1|This is a stupid typo.
2|Really?
3|No mor typos!
4|Enjoy!
(this is the end of the file)
[File updated (edited at line 1). Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]


----------
Expand All @@ -479,14 +479,14 @@ edit_file_by_replace(
----------

OBSERVATION:
[File: /workspace/bad.txt (4 lines total after edit)]
(this is the beginning of the file)
1|This is a stupid typo.
2|Really?
3|No more typos!
4|Enjoy!
(this is the end of the file)
[File updated (edited at line 3). Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]
[File: /workspace/bad.txt (4 lines total after edit)]
(this is the beginning of the file)
1|This is a stupid typo.
2|Really?
3|No more typos!
4|Enjoy!
(this is the end of the file)
[File updated (edited at line 3). Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.]


ENVIRONMENT REMINDER: You have 10 turns left to complete the task. When finished reply with <finish></finish>.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down Expand Up @@ -410,7 +410,7 @@ print("File created successfully.")
----------

OBSERVATION:
File created successfully.
File created successfully.


ENVIRONMENT REMINDER: You have 13 turns left to complete the task. When finished reply with <finish></finish>.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down Expand Up @@ -410,7 +410,7 @@ print("File created successfully.")
----------

OBSERVATION:
File created successfully.
File created successfully.


----------
Expand All @@ -425,7 +425,7 @@ print(f"Content of /workspace/test.txt: {content}")
----------

OBSERVATION:
Content of /workspace/test.txt: hello world
Content of /workspace/test.txt: hello world


ENVIRONMENT REMINDER: You have 12 turns left to complete the task. When finished reply with <finish></finish>.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down Expand Up @@ -424,7 +424,7 @@ print("Version written to /workspace/test.txt")
----------

OBSERVATION:
Version written to /workspace/test.txt
Version written to /workspace/test.txt


ENVIRONMENT REMINDER: You have 12 turns left to complete the task. When finished reply with <finish></finish>.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down Expand Up @@ -424,7 +424,7 @@ print("Version written to /workspace/test.txt")
----------

OBSERVATION:
Version written to /workspace/test.txt
Version written to /workspace/test.txt


----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scroll_up() -> None:
None

create_file(filename: str) -> None:
Creates and opens a new file with the given name.
Creates a file with the given name.
Args:
filename: str: The name of the file to create.

Expand Down
Loading

0 comments on commit 398fd92

Please sign in to comment.