Skip to content

Commit

Permalink
fix: removed incorrect calls to register_function, removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 2, 2024
1 parent 337b025 commit a4fa62e
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions gptme/tools/subagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from ..message import Message
from .base import ToolSpec, ToolUse
from .python import register_function

if TYPE_CHECKING:
# noreorder
Expand Down Expand Up @@ -63,21 +62,12 @@ def status(self) -> ReturnType:
return ReturnType(**json.loads(json_response)) # type: ignore


def _extract_json_re(s: str) -> str:
return re.sub(
r"(?s).+?(```json)?\n([{](.+?)+?[}])\n(```)?",
r"\2",
s,
).strip()


def _extract_json(s: str) -> str:
first_brace = s.find("{")
last_brace = s.rfind("}")
return s[first_brace : last_brace + 1]


@register_function
def subagent(prompt: str, agent_id: str):
"""Runs a subagent and returns the resulting JSON output."""
# noreorder
Expand Down Expand Up @@ -124,7 +114,6 @@ def run_subagent():
_subagents.append(Subagent(prompt, agent_id, t))


@register_function
def subagent_status(agent_id: str) -> dict:
"""Returns the status of a subagent."""
for subagent in _subagents:
Expand All @@ -133,7 +122,6 @@ def subagent_status(agent_id: str) -> dict:
raise ValueError(f"Subagent with ID {agent_id} not found.")


@register_function
def subagent_wait(agent_id: str) -> dict:
"""Waits for a subagent to finish. Timeout is 1 minute."""
subagent = None
Expand Down

0 comments on commit a4fa62e

Please sign in to comment.