Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Remove append to file (#5051)

merwanehamadi45c9566298d2
diff --git a/agbenchmark/benchmarks.py b/agbenchmark/benchmarks.py
index b3df802092..5bcbb7ef5c 100644
--- a/agbenchmark/benchmarks.py
+++ b/agbenchmark/benchmarks.py
@@ -1,3 +1,4 @@
+import os
import sys
from pathlib import Path
from typing import Tuple
diff --git a/autogpt/commands/file_operations.py b/autogpt/commands/file_operations.py
index adafe14ede..519a20cde0 100644
--- a/autogpt/commands/file_operations.py
+++ b/autogpt/commands/file_operations.py
@@ -228,22 +228,6 @@ def write_to_file(filename: str, text: str, agent: Agent) -> str:
return f"Error: {err}"
-@command(
- "append_to_file",
- "Appends to a file",
- {
- "filename": {
- "type": "string",
- "description": "The name of the file to write to",
- "required": True,
- },
- "text": {
- "type": "string",
- "description": "The text to write to the file",
- "required": True,
- },
- },
-)
@sanitize_path_arg("filename")
def append_to_file(
filename: str, text: str, agent: Agent, should_log: bool = True
diff --git a/autogpt/config/config.py b/autogpt/config/config.py
index 66f2e87139..c0d3091023 100644
--- a/autogpt/config/config.py
+++ b/autogpt/config/config.py
@@ -54,7 +54,7 @@ class Config(SystemSettings, arbitrary_types_allowed=True):
file_logger_path: Optional[Path] = None
# Model configuration
fast_llm: str = "gpt-3.5-turbo"
- smart_llm: str = "gpt-4"
+ smart_llm: str = "gpt-4-0314"
temperature: float = 0
openai_functions: bool = False
embedding_model: str = "text-embedding-ada-002"
diff --git a/autogpt/llm/utils/__init__.py b/autogpt/llm/utils/__init__.py
index 9eceae0db9..5438bdd853 100644
--- a/autogpt/llm/utils/__init__.py
+++ b/autogpt/llm/utils/__init__.py
@@ -119,7 +119,9 @@ def create_chat_completion(
temperature = config.temperature
if max_tokens is None:
prompt_tlength = prompt.token_length
- max_tokens = OPEN_AI_CHAT_MODELS[model].max_tokens - prompt_tlength
+ max_tokens = (
+ OPEN_AI_CHAT_MODELS[model].max_tokens - prompt_tlength - 1
+ ) # the -1 is just here because we have a bug and we don't know how to fix it. When using gpt-4-0314 we get a token error.
logger.debug(f"Prompt length: {prompt_tlength} tokens")
if functions:
functions_tlength = count_openai_functions_tokens(functions, model)
diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py
index 6445ae786e..80de7073a7 100644
--- a/tests/unit/test_config.py
+++ b/tests/unit/test_config.py
@@ -21,7 +21,7 @@ def test_initial_values(config: Config):
assert config.continuous_mode == False
assert config.speak_mode == False
assert config.fast_llm == "gpt-3.5-turbo"
- assert config.smart_llm == "gpt-4"
+ assert config.smart_llm == "gpt-4-0314"
def test_set_continuous_mode(config: Config):