From 4e8892b99e548a1fca27093cbc8815fbc968b810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Mon, 9 Sep 2024 18:38:52 +0200 Subject: [PATCH] more fixes --- gptme/tools/read.py | 5 +++++ gptme/tools/save.py | 13 ++----------- gptme/tools/subagent.py | 5 ++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/gptme/tools/read.py b/gptme/tools/read.py index 478caa829..2474e111b 100644 --- a/gptme/tools/read.py +++ b/gptme/tools/read.py @@ -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 @@ -9,3 +13,4 @@ cat file.txt ```""", ) +__doc__ = tool.get_doc(__doc__) diff --git a/gptme/tools/save.py b/gptme/tools/save.py index 7afced91c..8f7060274 100644 --- a/gptme/tools/save.py +++ b/gptme/tools/save.py @@ -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 @@ -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 @@ -160,3 +150,4 @@ def execute_append( execute=execute_append, block_types=["append"], ) +__doc__ = tool_append.get_doc(__doc__) diff --git a/gptme/tools/subagent.py b/gptme/tools/subagent.py index ee94827c3..85ca68ebf 100644 --- a/gptme/tools/subagent.py +++ b/gptme/tools/subagent.py @@ -12,7 +12,6 @@ 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 @@ -20,6 +19,7 @@ # noreorder from ..logmanager import LogManager # fmt: skip + logger = logging.getLogger(__name__) Status = Literal["running", "success", "failure"] @@ -163,8 +163,6 @@ def subagent_wait(agent_id: str) -> dict: ``` """ -__doc__ += transform_examples_to_chat_directives(examples) - tool = ToolSpec( name="subagent", @@ -172,3 +170,4 @@ def subagent_wait(agent_id: str) -> dict: examples=examples, functions=[subagent, subagent_status, subagent_wait], ) +__doc__ = tool.to_doc(__doc__)