Significant-Gravitas / AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
https://agpt.co
MIT License
166.45k stars 44.06k forks source link

Challenges: Update fixtures to be more modular #4250

Closed rihp closed 12 months ago

rihp commented 1 year ago

Duplicates

Summary 💡

We could do something like this to make agents fixtures for challenges be 8 lines instead of 20

Examples 🌈

From ChatGPT:

@pytest.fixture
def create_agent(agent_test_config, memory_local_cache, workspace: Workspace, ai_config_details: dict):
    command_registry = CommandRegistry()
    for command in ai_config_details['commands']:
        command_registry.import_commands(command)

    ai_config = AIConfig(
        ai_name=ai_config_details['ai_name'],
        ai_role=ai_config_details['ai_role'],
        ai_goals=ai_config_details['ai_goals'],
    )
    ai_config.command_registry = command_registry

    system_prompt = ai_config.construct_full_prompt()
    Config().set_continuous_mode(False)
    agent = Agent(
        ai_name=ai_config_details['ai_name'],
        memory=memory_local_cache,
        full_message_history=[],
        command_registry=command_registry,
        config=ai_config,
        next_action_count=0,
        system_prompt=system_prompt,
        triggering_prompt=DEFAULT_TRIGGERING_PROMPT,
        workspace_directory=workspace.root,
    )

    return agent

@pytest.fixture
def anthropic_information_agent(agent_test_config, memory_local_cache, workspace: Workspace):
    ai_config_details = {
        'ai_name': "Anthropic-Information",
        'ai_role': "an autonomous agent that specializes in researching about Anthropic's new LLM.",
        'ai_goals': [
            "How many tokens fit in the Anthropic LLM which was announced in Q2 2023? Write the answer to this question in a file called output.txt",
        ],
        'commands': ["autogpt.commands.file_operations", "autogpt.app"]
    }

    return create_agent(agent_test_config, memory_local_cache, workspace, ai_config_details)

# Repeat this pattern for all other agent fixtures

Motivation 🔦

Working on challenges

github-actions[bot] commented 1 year ago

This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.

github-actions[bot] commented 12 months ago

This issue was closed automatically because it has been stale for 10 days with no activity.