Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Sep 9, 2024
1 parent 3c98d5d commit 4e8892b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
5 changes: 5 additions & 0 deletions gptme/tools/read.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Read the contents of a file.
"""

from gptme.tools.base import ToolSpec

# Note: this isn't actually a tool, it only serves prompting purposes
Expand All @@ -9,3 +13,4 @@
cat file.txt
```""",
)
__doc__ = tool.get_doc(__doc__)
13 changes: 2 additions & 11 deletions gptme/tools/save.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
"""
Gives the assistant the ability to save code to a file.
Example:
.. chat::
User: write hello world to hello.py
Assistant:
```save hello.py
print("hello world")
```
System: Saved to hello.py
"""

from collections.abc import Generator
Expand Down Expand Up @@ -138,6 +127,7 @@ def execute_append(
execute=execute_save,
block_types=["save"],
)
__doc__ = tool_save.get_doc(__doc__)

instructions_append = """
To append code to a file, use a code block with the language: append <filepath>
Expand All @@ -160,3 +150,4 @@ def execute_append(
execute=execute_append,
block_types=["append"],
)
__doc__ = tool_append.get_doc(__doc__)
5 changes: 2 additions & 3 deletions gptme/tools/subagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from typing import TYPE_CHECKING, Literal

from ..message import Message
from ..util import transform_examples_to_chat_directives
from .base import ToolSpec
from .python import register_function

if TYPE_CHECKING:
# noreorder
from ..logmanager import LogManager # fmt: skip


logger = logging.getLogger(__name__)

Status = Literal["running", "success", "failure"]
Expand Down Expand Up @@ -163,12 +163,11 @@ def subagent_wait(agent_id: str) -> dict:
```
"""

__doc__ += transform_examples_to_chat_directives(examples)


tool = ToolSpec(
name="subagent",
desc="A tool to create subagents",
examples=examples,
functions=[subagent, subagent_status, subagent_wait],
)
__doc__ = tool.to_doc(__doc__)

0 comments on commit 4e8892b

Please sign in to comment.