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.
fix information retrieval challenge (#4448)
merwanehamadi44f6d946f5ab
diff --git a/docs/challenges/building_challenges.md b/docs/challenges/building_challenges.mdindex e59cad3ef9..09ab3bf513 100644--- a/docs/challenges/building_challenges.md+++ b/docs/challenges/building_challenges.md@@ -101,7 +101,6 @@ def input_generator(input_sequence: list) -> Generator[str, None, None]:@pytest.mark.skip("This challenge hasn't been beaten yet.")@pytest.mark.vcr@requires_api_key("OPENAI_API_KEY")-@run_multiple_times(3)def test_information_retrieval_challenge_a(kubernetes_agent, monkeypatch) -> None:"""Test the challenge_a function in a given agent by mocking user inputsdiff --git a/tests/integration/agent_factory.py b/tests/integration/agent_factory.pyindex c2f2d4f63d..713afb79ef 100644--- a/tests/integration/agent_factory.py+++ b/tests/integration/agent_factory.py@@ -145,17 +145,18 @@ def get_company_revenue_agent():command_registry = CommandRegistry()command_registry.import_commands("autogpt.commands.file_operations")+ command_registry.import_commands("autogpt.commands.google_search")command_registry.import_commands("autogpt.app")+ command_registry.import_commands("autogpt.commands.task_statuses")ai_config = AIConfig(- ai_name="Get-CompanyRevenue",- ai_role="an autonomous agent that specializes in finding the reported revenue of a company.",+ ai_name="Information Retrieval Agent",+ ai_role="an autonomous agent that specializes in retrieving information.",ai_goals=[- "Write the revenue of Tesla in 2022 to a file. You should write the number without commas and you should not use signs like B for billion and M for million.",+ "Search for 'tesla revenue 2022' and write the revenue of Tesla in 2022 to a file called output.txt. You should write the number without commas and you should not use signs like B for billion and M for million.",],)ai_config.command_registry = command_registry-system_prompt = ai_config.construct_full_prompt()Config().set_continuous_mode(False)agent = Agent(@@ -168,7 +169,6 @@ def get_company_revenue_agent(triggering_prompt=DEFAULT_TRIGGERING_PROMPT,workspace_directory=workspace.root,)-return agentdiff --git a/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py b/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.pyindex 42e9a99344..0a0c634ce8 100644--- a/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py+++ b/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py@@ -4,17 +4,15 @@ import pytestfrom autogpt.commands.file_operations import read_file, write_to_filefrom autogpt.config import Config-from tests.integration.challenges.utils import run_interaction_loop, run_multiple_times+from tests.integration.challenges.utils import run_interaction_loopfrom tests.utils import requires_api_keyCYCLE_COUNT = 3from autogpt.agent import Agent[email protected]("This challenge hasn't been beaten yet.")@pytest.mark.vcr@requires_api_key("OPENAI_API_KEY")-@run_multiple_times(3)def test_information_retrieval_challenge_a(get_company_revenue_agent: Agent,monkeypatch: pytest.MonkeyPatch,diff --git a/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.py b/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.pyindex b84f50185b..10bcfb1c10 100644--- a/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.py+++ b/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.py@@ -4,7 +4,7 @@ import yamlfrom autogpt.agent import Agentfrom autogpt.commands.file_operations import read_filefrom autogpt.config import Config-from tests.integration.challenges.utils import run_interaction_loop, run_multiple_times+from tests.integration.challenges.utils import run_interaction_loopfrom tests.utils import requires_api_keyCYCLE_COUNT = 6@@ -13,7 +13,6 @@ CYCLE_COUNT = 6@pytest.mark.skip("This challenge hasn't been beaten yet.")@pytest.mark.vcr@requires_api_key("OPENAI_API_KEY")-@run_multiple_times(3)def test_kubernetes_template_challenge_a(kubernetes_agent: Agent, monkeypatch: pytest.MonkeyPatch, config: Config) -> None:diff --git a/tests/integration/challenges/utils.py b/tests/integration/challenges/utils.pyindex d80ca977eb..b7bf83fed2 100644--- a/tests/integration/challenges/utils.py+++ b/tests/integration/challenges/utils.py@@ -48,24 +48,6 @@ def generate_noise(noise_size: int) -> str:)-def run_multiple_times(times: int) -> Callable:- """- Decorator that runs a test function multiple times.-- :param times: The number of times the test function should be executed.- """-- def decorator(test_func: Callable[..., Any]) -> Callable[..., Any]:- @wraps(test_func)- def wrapper(*args: Tuple[Any, ...], **kwargs: Dict[str, Any]) -> None:- for _ in range(times):- test_func(*args, **kwargs)-- return wrapper-- return decorator--def setup_mock_input(monkeypatch: pytest.MonkeyPatch, cycle_count: int) -> None:"""Sets up the mock input for testing.diff --git a/tests/vcr/vcr_filter.py b/tests/vcr/vcr_filter.pyindex 3a58bee986..a86f501a96 100644--- a/tests/vcr/vcr_filter.py+++ b/tests/vcr/vcr_filter.py@@ -19,6 +19,7 @@ REPLACEMENTS: List[Dict[str, str]] = [ALLOWED_HOSTNAMES: List[str] = ["api.openai.com","localhost:50337",+ "duckduckgo.com",]if PROXY: