Convert to python module named autogpt.

Also fixed the Dockerfile.
Converting to module makes development easier.
Fixes coverage script in CI and test imports.
This commit is contained in:
Dino Hensen
2023-04-14 18:28:58 +02:00
committed by Merwane Hamadi
parent a17a850b25
commit d64f866bfa
45 changed files with 352 additions and 90 deletions

View File

@@ -0,0 +1,29 @@
from autogpt.config import Config
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):
"""Call an AI function"""
if model is None:
model = cfg.smart_llm_model
# For each arg, if any are None, convert to "None":
args = [str(arg) if arg is not None else "None" for arg in args]
# parse args to comma separated string
args = ", ".join(args)
messages = [
{
"role": "system",
"content": f"You are now the following python function: ```# {description}\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