Skip to content

Commit

Permalink
[computer-use-demo] Fix use of its (anthropics#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinji authored Oct 29, 2024
1 parent 8f734fd commit c8b5fb3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions computer-use-demo/computer_use_demo/tools/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ async def view(self, path: Path, view_range: list[int] | None = None):
init_line, final_line = view_range
if init_line < 1 or init_line > n_lines_file:
raise ToolError(
f"Invalid `view_range`: {view_range}. It's first element `{init_line}` should be within the range of lines of the file: {[1, n_lines_file]}"
f"Invalid `view_range`: {view_range}. Its first element `{init_line}` should be within the range of lines of the file: {[1, n_lines_file]}"
)
if final_line > n_lines_file:
raise ToolError(
f"Invalid `view_range`: {view_range}. It's second element `{final_line}` should be smaller than the number of lines in the file: `{n_lines_file}`"
f"Invalid `view_range`: {view_range}. Its second element `{final_line}` should be smaller than the number of lines in the file: `{n_lines_file}`"
)
if final_line != -1 and final_line < init_line:
raise ToolError(
f"Invalid `view_range`: {view_range}. It's second element `{final_line}` should be larger or equal than its first `{init_line}`"
f"Invalid `view_range`: {view_range}. Its second element `{final_line}` should be larger or equal than its first `{init_line}`"
)

if final_line == -1:
Expand Down

0 comments on commit c8b5fb3

Please sign in to comment.