Skip to content

Commit

Permalink
AutoGPT: use config and LLM provider from core (#5286)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwuts authored Sep 21, 2023
2 parents 3f8088b + c773815 commit de527d3
Show file tree
Hide file tree
Showing 95 changed files with 1,808 additions and 2,568 deletions.
1 change: 0 additions & 1 deletion autogpts/autogpt/.flake8 → .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[flake8]
max-line-length = 88
select = "E303, W293, W291, W292, E305, E231, E302"
exclude =
.tox,
__pycache__,
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/autogpt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,24 @@ jobs:
poetry install
- name: Lint with flake8
run: flake8
run: poetry run flake8

- name: Check black formatting
run: black . --check
run: poetry run black . --check
if: success() || failure()

- name: Check isort formatting
run: isort . --check
run: poetry run isort . --check
if: success() || failure()

- name: Check mypy formatting
run: mypy
run: poetry run mypy
if: success() || failure()

- name: Check for unused imports and pass statements
run: |
cmd="autoflake --remove-all-unused-imports --recursive --ignore-init-module-imports --ignore-pass-after-docstring autogpt tests"
$cmd --check || (echo "You have unused imports or pass statements, please run '${cmd} --in-place'" && exit 1)
poetry run $cmd --check || (echo "You have unused imports or pass statements, please run '${cmd} --in-place'" && exit 1)
test:
# eliminate duplicate runs
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/autogpt-docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ jobs:
run: |
set +e
test_output=$(
docker run --env CI --env OPENAI_API_KEY ${{ env.IMAGE_NAME }} run \
pytest -v --cov=autogpt --cov-branch --cov-report term-missing \
docker run --env CI --env OPENAI_API_KEY \
--entrypoint poetry ${{ env.IMAGE_NAME }} run \
run pytest -v --cov=autogpt --cov-branch --cov-report term-missing \
--numprocesses=4 --durations=10 \
tests/unit tests/integration 2>&1
)
Expand Down
30 changes: 22 additions & 8 deletions autogpts/autogpt/agbenchmark_config/benchmarks.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import asyncio
import sys
from pathlib import Path

from autogpt.agents import Agent
from autogpt.app.main import run_interaction_loop
from autogpt.agents.agent import Agent, AgentConfiguration, AgentSettings
from autogpt.app.main import _configure_openai_provider, run_interaction_loop
from autogpt.commands import COMMAND_CATEGORIES
from autogpt.config import AIConfig, ConfigBuilder
from autogpt.logs.config import configure_logging
from autogpt.memory.vector import get_memory
from autogpt.models.command_registry import CommandRegistry
from autogpt.prompts.prompt import DEFAULT_TRIGGERING_PROMPT
from autogpt.workspace import Workspace

PROJECT_DIR = Path().resolve()
Expand All @@ -17,7 +17,7 @@

def run_specific_agent(task: str, continuous_mode: bool = False) -> None:
agent = bootstrap_agent(task, continuous_mode)
run_interaction_loop(agent)
asyncio.run(run_interaction_loop(agent))


def bootstrap_agent(task: str, continuous_mode: bool) -> Agent:
Expand All @@ -41,12 +41,26 @@ def bootstrap_agent(task: str, continuous_mode: bool) -> Agent:
ai_role="a multi-purpose AI assistant.",
ai_goals=[task],
)

agent_settings = AgentSettings(
name=Agent.default_settings.name,
description=Agent.default_settings.description,
ai_config=ai_config,
config=AgentConfiguration(
fast_llm=config.fast_llm,
smart_llm=config.smart_llm,
use_functions_api=config.openai_functions,
plugins=config.plugins,
),
history=Agent.default_settings.history.copy(deep=True),
)

return Agent(
memory=get_memory(config),
settings=agent_settings,
llm_provider=_configure_openai_provider(config),
command_registry=command_registry,
ai_config=ai_config,
config=config,
triggering_prompt=DEFAULT_TRIGGERING_PROMPT,
memory=get_memory(config),
legacy_config=config,
)


Expand Down
Loading

0 comments on commit de527d3

Please sign in to comment.