Skip to content

Commit

Permalink
Fixes LLM thinking command descriptions are orders
Browse files Browse the repository at this point in the history
Signed-off-by: Merwane Hamadi <[email protected]>
  • Loading branch information
waynehamadi committed Jun 19, 2023
1 parent 162d777 commit f4c000a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 13 deletions.
8 changes: 4 additions & 4 deletions autogpt/commands/execute_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@command(
"execute_python_code",
"Create a Python file and execute it",
"Creates a Python file and executes it",
{
"code": {
"type": "string",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions autogpt/commands/file_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def ingest_file(

@command(
"write_to_file",
"Write to file",
"Writes to a file",
{
"filename": {
"type": "string",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -261,7 +261,7 @@ def append_to_file(

@command(
"delete_file",
"Delete file",
"Deletes a file",
{
"filename": {
"type": "string",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion autogpt/commands/git_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@command(
"clone_repository",
"Clone Repository",
"Clones a Repository",
{
"url": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion autogpt/commands/image_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@command(
"generate_image",
"Generate Image",
"Generates an Image",
{
"prompt": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion autogpt/commands/web_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@command(
"web_search",
"Search the web",
"Searches the web",
{
"query": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion autogpt/commands/web_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

@command(
"browse_website",
"Browse Website",
"Browses a Website",
{
"url": {"type": "string", "description": "The URL to visit", "required": True},
"question": {
Expand Down
2 changes: 2 additions & 0 deletions autogpt/llm/api_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import openai
from openai import Model

from autogpt.llm.base import CompletionModelInfo
from autogpt.logs import logger
from autogpt.singleton import Singleton
Expand Down Expand Up @@ -35,6 +36,7 @@ def update_cost(self, prompt_tokens, completion_tokens, model):
"""
# 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]

Expand Down
1 change: 1 addition & 0 deletions autogpt/llm/providers/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_api_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from unittest.mock import MagicMock, patch
from unittest.mock import patch

import pytest
from pytest_mock import MockerFixture
Expand Down

0 comments on commit f4c000a

Please sign in to comment.