Remove append to file (#5051)

Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
This commit is contained in:
merwanehamadi
2023-07-29 10:55:19 -07:00
committed by GitHub
parent cdafee02fc
commit 45c9566298
5 changed files with 6 additions and 19 deletions

View File

@@ -1,3 +1,4 @@
import os
import sys
from pathlib import Path
from typing import Tuple

View File

@@ -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

View File

@@ -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"

View File

@@ -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)

View File

@@ -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):