Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwuts committed Jul 7, 2023
2 parents 8d9438c + 3b7e101 commit 5d49557
Show file tree
Hide file tree
Showing 103 changed files with 4,442 additions and 334 deletions.
12 changes: 8 additions & 4 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ OPENAI_API_KEY=your-openai-api-key
## USE_AZURE - Use Azure OpenAI or not (Default: False)
# USE_AZURE=False

## AZURE_CONFIG_FILE - The path to the azure.yaml file (Default: azure.yaml)
# AZURE_CONFIG_FILE=azure.yaml


################################################################################
### LLM MODELS
################################################################################

## SMART_LLM_MODEL - Smart language model (Default: gpt-3.5-turbo)
# SMART_LLM_MODEL=gpt-3.5-turbo
## SMART_LLM - Smart language model (Default: gpt-4)
# SMART_LLM=gpt-4

## FAST_LLM_MODEL - Fast language model (Default: gpt-3.5-turbo)
# FAST_LLM_MODEL=gpt-3.5-turbo
## FAST_LLM - Fast language model (Default: gpt-3.5-turbo)
# FAST_LLM=gpt-3.5-turbo

## EMBEDDING_MODEL - Model to use for creating embeddings
# EMBEDDING_MODEL=text-embedding-ada-002
Expand Down
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.github/workflows/ @Significant-Gravitas/Auto-GPT-Source
.github/workflows/ @Significant-Gravitas/maintainers
autogpt/core @collijk
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/1.bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ body:
⚠️The following is OPTIONAL, please keep in mind that the log files may contain personal information such as credentials.⚠️
"The log files are located in the folder 'logs' inside the main auto-gpt folder."
- type: input
- type: textarea
attributes:
label: Upload Activity Log Content
description: |
Expand All @@ -152,7 +152,7 @@ body:
validations:
required: false

- type: input
- type: textarea
attributes:
label: Upload Error Log Content
description: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
types: [ python ]
- id: pytest-check
name: pytest-check
entry: pytest --cov=autogpt --without-integration --without-slow-integration
entry: pytest --cov=autogpt tests/unit
language: system
pass_filenames: false
always_run: true
25 changes: 12 additions & 13 deletions autogpt/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def __init__(
self.created_at = datetime.now().strftime("%Y%m%d_%H%M%S")
self.cycle_count = 0
self.log_cycle_handler = LogCycleHandler()
self.fast_token_limit = OPEN_AI_CHAT_MODELS.get(
config.fast_llm_model
).max_tokens
self.smart_token_limit = OPEN_AI_CHAT_MODELS.get(config.smart_llm).max_tokens

def start_interaction_loop(self):
# Avoid circular imports
Expand Down Expand Up @@ -138,8 +136,8 @@ def signal_handler(signum, frame):
self,
self.system_prompt,
self.triggering_prompt,
self.fast_token_limit,
self.config.fast_llm_model,
self.smart_token_limit,
self.config.smart_llm,
)

try:
Expand Down Expand Up @@ -167,7 +165,7 @@ def signal_handler(signum, frame):
assistant_reply_json, assistant_reply, self.config
)
if self.config.speak_mode:
say_text(f"I want to execute {command_name}")
say_text(f"I want to execute {command_name}", self.config)

arguments = self._resolve_pathlike_command_args(arguments)

Expand Down Expand Up @@ -196,8 +194,9 @@ def signal_handler(signum, frame):
# to exit
self.user_input = ""
logger.info(
"Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands, "
"'n' to exit program, or enter feedback for "
f"Enter '{self.config.authorise_key}' to authorise command, "
f"'{self.config.authorise_key} -N' to run N continuous commands, "
f"'{self.config.exit_key}' to exit program, or enter feedback for "
f"{self.ai_name}..."
)
while True:
Expand Down Expand Up @@ -225,8 +224,8 @@ def signal_handler(signum, frame):
user_input = "GENERATE NEXT COMMAND JSON"
except ValueError:
logger.warn(
"Invalid input format. Please enter 'y -n' where n is"
" the number of continuous tasks."
f"Invalid input format. Please enter '{self.config.authorise_key} -n' "
"where n is the number of continuous tasks."
)
continue
break
Expand Down Expand Up @@ -282,12 +281,12 @@ def signal_handler(signum, frame):
result = f"Command {command_name} returned: " f"{command_result}"

result_tlength = count_string_tokens(
str(command_result), self.config.fast_llm_model
str(command_result), self.config.smart_llm
)
memory_tlength = count_string_tokens(
str(self.history.summary_message()), self.config.fast_llm_model
str(self.history.summary_message()), self.config.smart_llm
)
if result_tlength + memory_tlength + 600 > self.fast_token_limit:
if result_tlength + memory_tlength + 600 > self.smart_token_limit:
result = f"Failure: command {command_name} returned too much output. \
Do not execute this command again with the same arguments."

Expand Down
24 changes: 24 additions & 0 deletions autogpt/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Main script for the autogpt package."""
from typing import Optional

import click


Expand Down Expand Up @@ -65,6 +67,22 @@
is_flag=True,
help="Installs external dependencies for 3rd party plugins.",
)
@click.option(
"--ai-name",
type=str,
help="AI name override",
)
@click.option(
"--ai-role",
type=str,
help="AI role override",
)
@click.option(
"--ai-goal",
type=str,
multiple=True,
help="AI goal override; may be used multiple times to pass multiple goals",
)
@click.pass_context
def main(
ctx: click.Context,
Expand All @@ -83,6 +101,9 @@ def main(
skip_news: bool,
workspace_directory: str,
install_plugin_deps: bool,
ai_name: Optional[str],
ai_role: Optional[str],
ai_goal: tuple[str],
) -> None:
"""
Welcome to AutoGPT an experimental open-source application showcasing the capabilities of the GPT-4 pushing the boundaries of AI.
Expand All @@ -109,6 +130,9 @@ def main(
skip_news,
workspace_directory,
install_plugin_deps,
ai_name,
ai_role,
ai_goal,
)


Expand Down
13 changes: 5 additions & 8 deletions autogpt/config/ai_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(
self,
ai_name: str = "",
ai_role: str = "",
ai_goals: list | None = None,
ai_goals: list[str] = [],
api_budget: float = 0.0,
) -> None:
"""
Expand All @@ -49,8 +49,6 @@ def __init__(
Returns:
None
"""
if ai_goals is None:
ai_goals = []
self.ai_name = ai_name
self.ai_role = ai_role
self.ai_goals = ai_goals
Expand All @@ -61,13 +59,12 @@ def __init__(
@staticmethod
def load(ai_settings_file: str = SAVE_FILE) -> "AIConfig":
"""
Returns class object with parameters (ai_name, ai_role, ai_goals, api_budget) loaded from
yaml file if yaml file exists,
else returns class with no parameters.
Returns class object with parameters (ai_name, ai_role, ai_goals, api_budget)
loaded from yaml file if yaml file exists, else returns class with no parameters.
Parameters:
ai_settings_file (int): The path to the config yaml file.
DEFAULT: "../ai_settings.yaml"
ai_settings_file (int): The path to the config yaml file.
DEFAULT: "../ai_settings.yaml"
Returns:
cls (object): An instance of given cls object
Expand Down
Loading

0 comments on commit 5d49557

Please sign in to comment.