Fixes LLM thinking command descriptions are orders
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>pull/4741/head
parent
162d77707b
commit
f4c000a547
|
@ -18,7 +18,7 @@ DENYLIST_CONTROL = "denylist"
|
|||
|
||||
@command(
|
||||
"execute_python_code",
|
||||
"Create a Python file and execute it",
|
||||
"Creates a Python file and executes it",
|
||||
{
|
||||
"code": {
|
||||
"type": "string",
|
||||
|
@ -63,7 +63,7 @@ def execute_python_code(code: str, name: str, agent: Agent) -> str:
|
|||
|
||||
@command(
|
||||
"execute_python_file",
|
||||
"Execute an existing Python file",
|
||||
"Executes an existing Python file",
|
||||
{
|
||||
"filename": {
|
||||
"type": "string",
|
||||
|
@ -191,7 +191,7 @@ def validate_command(command: str, config: Config) -> bool:
|
|||
|
||||
@command(
|
||||
"execute_shell",
|
||||
"Execute Shell Command, non-interactive commands only",
|
||||
"Executes a Shell Command, non-interactive commands only",
|
||||
{
|
||||
"command_line": {
|
||||
"type": "string",
|
||||
|
@ -237,7 +237,7 @@ def execute_shell(command_line: str, agent: Agent) -> str:
|
|||
|
||||
@command(
|
||||
"execute_shell_popen",
|
||||
"Execute Shell Command, non-interactive commands only",
|
||||
"Executes a Shell Command, non-interactive commands only",
|
||||
{
|
||||
"query": {
|
||||
"type": "string",
|
||||
|
|
|
@ -176,7 +176,7 @@ def ingest_file(
|
|||
|
||||
@command(
|
||||
"write_to_file",
|
||||
"Write to file",
|
||||
"Writes to a file",
|
||||
{
|
||||
"filename": {
|
||||
"type": "string",
|
||||
|
@ -216,7 +216,7 @@ def write_to_file(filename: str, text: str, agent: Agent) -> str:
|
|||
|
||||
@command(
|
||||
"append_to_file",
|
||||
"Append to file",
|
||||
"Appends to a file",
|
||||
{
|
||||
"filename": {
|
||||
"type": "string",
|
||||
|
@ -261,7 +261,7 @@ def append_to_file(
|
|||
|
||||
@command(
|
||||
"delete_file",
|
||||
"Delete file",
|
||||
"Deletes a file",
|
||||
{
|
||||
"filename": {
|
||||
"type": "string",
|
||||
|
@ -291,7 +291,7 @@ def delete_file(filename: str, agent: Agent) -> str:
|
|||
|
||||
@command(
|
||||
"list_files",
|
||||
"List Files in Directory",
|
||||
"Lists Files in a Directory",
|
||||
{
|
||||
"directory": {
|
||||
"type": "string",
|
||||
|
|
|
@ -9,7 +9,7 @@ from autogpt.url_utils.validators import validate_url
|
|||
|
||||
@command(
|
||||
"clone_repository",
|
||||
"Clone Repository",
|
||||
"Clones a Repository",
|
||||
{
|
||||
"url": {
|
||||
"type": "string",
|
||||
|
|
|
@ -16,7 +16,7 @@ from autogpt.logs import logger
|
|||
|
||||
@command(
|
||||
"generate_image",
|
||||
"Generate Image",
|
||||
"Generates an Image",
|
||||
{
|
||||
"prompt": {
|
||||
"type": "string",
|
||||
|
|
|
@ -15,7 +15,7 @@ DUCKDUCKGO_MAX_ATTEMPTS = 3
|
|||
|
||||
@command(
|
||||
"web_search",
|
||||
"Search the web",
|
||||
"Searches the web",
|
||||
{
|
||||
"query": {
|
||||
"type": "string",
|
||||
|
|
|
@ -41,7 +41,7 @@ FILE_DIR = Path(__file__).parent.parent
|
|||
|
||||
@command(
|
||||
"browse_website",
|
||||
"Browse Website",
|
||||
"Browses a Website",
|
||||
{
|
||||
"url": {"type": "string", "description": "The URL to visit", "required": True},
|
||||
"question": {
|
||||
|
|
|
@ -4,6 +4,7 @@ from typing import List, Optional
|
|||
|
||||
import openai
|
||||
from openai import Model
|
||||
|
||||
from autogpt.llm.base import CompletionModelInfo
|
||||
from autogpt.logs import logger
|
||||
from autogpt.singleton import Singleton
|
||||
|
@ -35,6 +36,7 @@ class ApiManager(metaclass=Singleton):
|
|||
"""
|
||||
# the .model property in API responses can contain version suffixes like -v2
|
||||
from autogpt.llm.providers.openai import OPEN_AI_MODELS
|
||||
|
||||
model = model[:-3] if model.endswith("-v2") else model
|
||||
model_info = OPEN_AI_MODELS[model]
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ OPEN_AI_MODELS: dict[str, ChatModelInfo | EmbeddingModelInfo | TextModelInfo] =
|
|||
def meter_api(func):
|
||||
"""Adds ApiManager metering to functions which make OpenAI API calls"""
|
||||
from autogpt.llm.api_manager import ApiManager
|
||||
|
||||
api_manager = ApiManager()
|
||||
|
||||
openai_obj_processor = openai.util.convert_to_openai_object
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from pytest_mock import MockerFixture
|
||||
|
|
Loading…
Reference in New Issue