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 cassettes recording (#3342)
merwanehamadi7a006afb17a3
diff --git a/tests/integration/conftest.py b/tests/integration/conftest.pyindex 3c2e02b312..4534bce83f 100644--- a/tests/integration/conftest.py+++ b/tests/integration/conftest.py@@ -1,6 +1,6 @@import pytest-from tests.vcr.openai_filter import before_record_request+from tests.vcr.openai_filter import before_record_request, before_record_response@pytest.fixture@@ -9,8 +9,9 @@ def vcr_config():return {"record_mode": "new_episodes","before_record_request": before_record_request,+ "before_record_response": before_record_response,"filter_headers": [- "authorization",+ "Authorization","X-OpenAI-Client-User-Agent","User-Agent",],diff --git a/tests/integration/goal_oriented/cassettes/test_write_file/test_write_file.yaml b/tests/integration/goal_oriented/cassettes/test_write_file/test_write_file.yamlindex 1a5bba5c4a..482042f8f2 100644--- a/tests/integration/goal_oriented/cassettes/test_write_file/test_write_file.yaml+++ b/tests/integration/goal_oriented/cassettes/test_write_file/test_write_file.yaml@@ -86,8 +86,6 @@ interactions:- Wed, 26 Apr 2023 16:40:03 GMTServer:- cloudflare- Transfer-Encoding:- - chunkedaccess-control-allow-origin:- '*'alt-svc:@@ -213,8 +211,6 @@ interactions:- Wed, 26 Apr 2023 16:40:20 GMTServer:- cloudflare- Transfer-Encoding:- - chunkedaccess-control-allow-origin:- '*'alt-svc:diff --git a/tests/integration/goal_oriented/test_write_file.py b/tests/integration/goal_oriented/test_write_file.pyindex 92ebbc5623..739b0f20a1 100644--- a/tests/integration/goal_oriented/test_write_file.py+++ b/tests/integration/goal_oriented/test_write_file.py@@ -50,6 +50,9 @@ def create_writer_agent(workspace):],)ai_config.command_registry = command_registry+ CFG.set_continuous_mode(True)+ CFG.set_memory_backend("no_memory")+ CFG.set_temperature(0)memory = get_memory(CFG, init=True)triggering_prompt = ("Determine which next command to use, and respond using the"@@ -68,9 +71,7 @@ def create_writer_agent(workspace):triggering_prompt=triggering_prompt,workspace_directory=workspace.root,)- CFG.set_continuous_mode(True)- CFG.set_memory_backend("no_memory")- CFG.set_temperature(0)+os.environ["TIKTOKEN_CACHE_DIR"] = ""return agentdiff --git a/tests/vcr/openai_filter.py b/tests/vcr/openai_filter.pyindex 56a7eaec22..b18b694b8a 100644--- a/tests/vcr/openai_filter.py+++ b/tests/vcr/openai_filter.py@@ -26,6 +26,12 @@ def replace_timestamp_in_request(request):return request+def before_record_response(response):+ if "Transfer-Encoding" in response["headers"]:+ del response["headers"]["Transfer-Encoding"]+ return response++def before_record_request(request):filtered_request = filter_hostnames(request)filtered_request_without_dynamic_data = replace_timestamp_in_request(