Revert dumb changes

This commit is contained in:
Zamil Majdy
2024-05-20 17:07:55 +07:00
parent 81ad3cb69a
commit 47eeaf0325
3 changed files with 7 additions and 43 deletions

View File

@@ -150,7 +150,7 @@ class Agent(BaseAgent, Configurable[AgentSettings]):
self.event_history = settings.history
self.legacy_config = legacy_config
async def propose_action(self) -> BaseAgentActionProposal:
async def propose_action(self) -> OneShotAgentActionProposal:
"""Proposes the next action to execute, based on the task and current state.
Returns:
@@ -202,12 +202,12 @@ class Agent(BaseAgent, Configurable[AgentSettings]):
async def complete_and_parse(
self, prompt: ChatPrompt, exception: Optional[Exception] = None
) -> BaseAgentActionProposal:
) -> OneShotAgentActionProposal:
if exception:
prompt.messages.append(ChatMessage.system(f"Error: {exception}"))
response: ChatModelResponse[
BaseAgentActionProposal
OneShotAgentActionProposal
] = await self.llm_provider.create_chat_completion(
prompt.messages,
model_name=self.llm.name,
@@ -231,7 +231,7 @@ class Agent(BaseAgent, Configurable[AgentSettings]):
async def execute(
self,
proposal: BaseAgentActionProposal,
proposal: OneShotAgentActionProposal,
user_feedback: str = "",
) -> ActionResult:
tool = proposal.use_tool
@@ -266,7 +266,7 @@ class Agent(BaseAgent, Configurable[AgentSettings]):
return result
async def do_not_execute(
self, denied_proposal: BaseAgentActionProposal, user_feedback: str
self, denied_proposal: OneShotAgentActionProposal, user_feedback: str
) -> ActionResult:
result = ActionInterruptedByHuman(feedback=user_feedback)
self.log_cycle_handler.log_cycle(

View File

@@ -2,20 +2,17 @@
from logging import _nameToLevel as logLevelMap
from pathlib import Path
from typing import Optional
from dotenv import load_dotenv
load_dotenv()
import click
from forge.logging.config import LogFormatName
# from .telemetry import setup_telemetry
from .telemetry import setup_telemetry
@click.group(invoke_without_command=True)
@click.pass_context
def cli(ctx: click.Context):
# setup_telemetry()
setup_telemetry()
# Invoke `run` by default
if ctx.invoked_subcommand is None:

View File

@@ -1,33 +0,0 @@
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Callable, Iterable, TypeVar
if TYPE_CHECKING:
from autogpt.models.command import Command
from autogpt.core.resource.model_providers import CompletionModelFunction
logger = logging.getLogger(__name__)
T = TypeVar("T", bound=Callable)
def function_specs_from_commands(
commands: Iterable[Command],
) -> list[CompletionModelFunction]:
"""Get OpenAI-consumable function specs for the agent's available commands.
see https://platform.openai.com/docs/guides/gpt/function-calling
"""
return [
CompletionModelFunction(
name=command.names[0],
description=command.description,
is_async=command.is_async,
parameters={param.name: param.spec for param in command.parameters},
return_type=command.return_type,
)
for command in commands
]