Fix everything (#1444)

* Pi's message.

* Fix most everything.

* Blacked
This commit is contained in:
BillSchumacher
2023-04-14 19:04:48 -05:00
committed by GitHub
parent b65b7acace
commit 4bb7a598a5
25 changed files with 331 additions and 257 deletions

View File

@@ -1,13 +1,12 @@
from autogpt.config import Config
from autogpt.llm_utils import create_chat_completion
cfg = Config()
from autogpt.llm_utils import create_chat_completion
# This is a magic function that can do anything with no-code. See
# https://github.com/Torantulino/AI-Functions for more info.
def call_ai_function(function, args, description, model=None):
def call_ai_function(function, args, description, model=None) -> str:
"""Call an AI function"""
if model is None:
model = cfg.smart_llm_model
@@ -18,11 +17,10 @@ def call_ai_function(function, args, description, model=None):
messages = [
{
"role": "system",
"content": f"You are now the following python function: ```# {description}\n{function}```\n\nOnly respond with your `return` value.",
"content": f"You are now the following python function: ```# {description}"
f"\n{function}```\n\nOnly respond with your `return` value.",
},
{"role": "user", "content": args},
]
response = create_chat_completion(model=model, messages=messages, temperature=0)
return response
return create_chat_completion(model=model, messages=messages, temperature=0)