forked from Significant-Gravitas/AutoGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Simple web server" challenge (Significant-Gravitas#74)
Co-authored-by: Silen Naihin <silen.naihin@gmail.com>
- Loading branch information
1 parent
30ba515
commit 437e066
Showing
7 changed files
with
160 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
from typing import Any, Dict | ||
from unittest.mock import Mock, patch | ||
|
||
import requests | ||
|
||
|
||
def make_assertion() -> None: | ||
if os.environ.get("MOCK_TEST", "False").lower() == "true": | ||
mock_response = Mock(requests.Response) | ||
mock_response.status_code = 200 | ||
mock_response.json.return_value = {"status": "OK"} | ||
|
||
with patch("requests.get", return_value=mock_response): | ||
make_request_and_assert() | ||
else: | ||
make_request_and_assert() | ||
|
||
|
||
def make_request_and_assert() -> Dict[str, Any]: | ||
response = requests.get("http://localhost:8079/health") | ||
if response.status_code != 200: | ||
raise AssertionError( | ||
f"Expected status code 200, but got {response.status_code}" | ||
) | ||
|
||
return response.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "TestCreateSimpleWebServer", | ||
"category": ["code"], | ||
"task": "Build a basic web server that responds to a GET localhost:8079/health with a 200 OK. Deploy this web server locally at the port 8079. ", | ||
"dependencies": ["TestDebugSimpleTypoWithGuidance"], | ||
"ground": { | ||
"answer": "GET localhost:8079/health responds with a 200 OK", | ||
"should_contain": [], | ||
"should_not_contain": [], | ||
"files": [], | ||
"type": "custom_python" | ||
}, | ||
"info": { | ||
"difficulty": "medium", | ||
"description": "Tests ability for the agent to build a simple web server locally", | ||
"side_effects": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,90 @@ | ||
{ | ||
"TestWriteFile": { | ||
"TestBasicMemory": { | ||
"difficulty": "basic", | ||
"dependencies": [], | ||
"test": "agbenchmark\\challenges\\interface\\write_file" | ||
"dependencies": [ | ||
"TestReadFile", | ||
"TestWriteFile" | ||
], | ||
"test": "agbenchmark/challenges/memory/m1" | ||
}, | ||
"TestReadFile": { | ||
"TestBasicRetrieval": { | ||
"difficulty": "basic", | ||
"dependencies": [ | ||
"TestWriteFile" | ||
"TestWriteFile", | ||
"TestSearch" | ||
], | ||
"test": "agbenchmark\\challenges\\interface\\read_file" | ||
"test": "agbenchmark/challenges/retrieval/r1" | ||
}, | ||
"TestBasicMemory": { | ||
"TestCreateSimpleWebServer": { | ||
"difficulty": "basic", | ||
"dependencies": [], | ||
"test": "agbenchmark/challenges/code/d3" | ||
}, | ||
"TestDebugSimpleTypoWithGuidance": { | ||
"difficulty": "basic", | ||
"dependencies": [ | ||
"TestReadFile", | ||
"TestWriteFile" | ||
], | ||
"test": "agbenchmark\\challenges\\memory\\m1" | ||
"test": "agbenchmark/challenges/code/d1" | ||
}, | ||
"TestBasicRetrieval": { | ||
"TestDebugSimpleTypoWithoutGuidance": { | ||
"difficulty": "medium", | ||
"dependencies": [ | ||
"TestDebugSimpleTypoWithGuidance" | ||
], | ||
"test": "agbenchmark/challenges/code/d2" | ||
}, | ||
"TestReadFile": { | ||
"difficulty": "basic", | ||
"dependencies": [ | ||
"TestWriteFile" | ||
], | ||
"test": "agbenchmark\\challenges\\retrieval\\r1" | ||
"test": "agbenchmark/challenges/interface/read_file" | ||
}, | ||
"TestRememberMultipleIds": { | ||
"difficulty": "basic", | ||
"dependencies": [ | ||
"TestBasicMemory" | ||
], | ||
"test": "agbenchmark\\challenges\\memory\\m2" | ||
"test": "agbenchmark/challenges/memory/m2" | ||
}, | ||
"TestRetrieval2": { | ||
"difficulty": "basic", | ||
"TestRememberMultipleIdsWithNoise": { | ||
"difficulty": "medium", | ||
"dependencies": [ | ||
"TestBasicRetrieval" | ||
"TestRememberMultipleIds" | ||
], | ||
"test": "agbenchmark\\challenges\\retrieval\\r2" | ||
"test": "agbenchmark/challenges/memory/m3" | ||
}, | ||
"TestRememberMultipleIdsWithNoise": { | ||
"TestRememberMultiplePhrasesWithNoise": { | ||
"difficulty": "medium", | ||
"dependencies": [ | ||
"TestRememberMultipleIds" | ||
"TestRememberMultipleIdsWithNoise" | ||
], | ||
"test": "agbenchmark\\challenges\\memory\\m3" | ||
"test": "agbenchmark/challenges/memory/m4" | ||
}, | ||
"TestRetrieval3": { | ||
"TestRetrieval2": { | ||
"difficulty": "basic", | ||
"dependencies": [ | ||
"TestRetrieval2" | ||
"TestBasicRetrieval" | ||
], | ||
"test": "agbenchmark\\challenges\\retrieval\\r3" | ||
"test": "agbenchmark/challenges/retrieval/r2" | ||
}, | ||
"TestRememberMultiplePhrasesWithNoise": { | ||
"difficulty": "medium", | ||
"TestRetrieval3": { | ||
"difficulty": "basic", | ||
"dependencies": [ | ||
"TestRememberMultipleIdsWithNoise" | ||
"TestRetrieval2" | ||
], | ||
"test": "agbenchmark\\challenges\\memory\\m4" | ||
"test": "agbenchmark/challenges/retrieval/r3" | ||
}, | ||
"TestSearch": { | ||
"difficulty": "basic", | ||
"dependencies": [], | ||
"test": "agbenchmark\\challenges\\interface\\search" | ||
"test": "agbenchmark/challenges/interface/search" | ||
}, | ||
"TestWriteFile": { | ||
"difficulty": "basic", | ||
"dependencies": [], | ||
"test": "agbenchmark/challenges/interface/write_file" | ||
} | ||
} |