-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
1,182 additions
and
95 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
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,22 @@ | ||
from autogen import UserProxyAgent, ConversableAgent, config_list_from_json | ||
|
||
|
||
def main(): | ||
# Load LLM inference endpoints from an env variable or a file | ||
# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints | ||
# and OAI_CONFIG_LIST_sample. | ||
# For example, if you have created a OAI_CONFIG_LIST file in the current working directory, that file will be used. | ||
config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST") | ||
|
||
# Create the agent that uses the LLM. | ||
assistant = ConversableAgent("agent", llm_config={"config_list": config_list}) | ||
|
||
# Create the agent that represents the user in the conversation. | ||
user_proxy = UserProxyAgent("user", code_execution_config=False) | ||
|
||
# Let the assistant start the conversation. It will end when the user types exit. | ||
assistant.initiate_chat(user_proxy, message="How can I help you today?") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,16 @@ | ||
# Host a jsPsych experiment in Azure | ||
FROM python:3.11 | ||
MAINTAINER AutoGen | ||
|
||
# Upgrade pip | ||
RUN pip install --upgrade pip | ||
|
||
# Set the image to the Pacific Timezone | ||
RUN ln -snf /usr/share/zoneinfo/US/Pacific /etc/localtime && echo "US/Pacific" > /etc/timezone | ||
|
||
# Pre-load autogen dependencies, but not autogen itself since we'll often want to install the latest from source | ||
RUN pip install pyautogen[teachable,lmm,graphs] | ||
RUN pip uninstall --yes pyautogen | ||
|
||
# Pre-load popular packages as per https://learnpython.com/blog/most-popular-python-packages/ | ||
RUN pip install numpy pandas matplotlib seaborn scikit-learn requests urllib3 nltk pillow pytest |
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 +1,5 @@ | ||
git+https://github.com/microsoft/autogen.git | ||
pandas | ||
beautifulsoup4 | ||
requests | ||
pytest |
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,3 +1,3 @@ | ||
The AutoGPT style tasks are contained in folder `challenges`. | ||
|
||
Run `python utils/prepare_data.py` to convert the tasks to jsonl format compatible for evaluation. | ||
Run `python ../../utils/prepare_autogpt.py` to convert the tasks to jsonl format compatible for evaluation. |
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
25 changes: 25 additions & 0 deletions
25
...ools/testbed/scenarios/AutoGPT/challenges/10_password_generator/custom_python/test_pwd.py
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,25 @@ | ||
import unittest | ||
|
||
import password_generator | ||
|
||
|
||
class TestPasswordGenerator(unittest.TestCase): | ||
def test_password_length(self): | ||
for i in range(8, 17): | ||
password = password_generator.generate_password(i) | ||
self.assertEqual(len(password), i) | ||
|
||
def test_value_error(self): | ||
with self.assertRaises(ValueError): | ||
password_generator.generate_password(7) | ||
with self.assertRaises(ValueError): | ||
password_generator.generate_password(17) | ||
|
||
def test_password_content(self): | ||
password = password_generator.generate_password() | ||
self.assertTrue(any(c.isdigit() for c in password)) | ||
self.assertTrue(any(c in password_generator.string.punctuation for c in password)) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
28 changes: 28 additions & 0 deletions
28
samples/tools/testbed/scenarios/AutoGPT/challenges/10_password_generator/data.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,28 @@ | ||
{ | ||
"category": [ | ||
"coding" | ||
], | ||
"cutoff": 90, | ||
"dependencies": [ | ||
"TestThreeSum" | ||
], | ||
"eval_id": "ac75c471-e0ce-400c-ba9a-fb72aaab444f", | ||
"ground": { | ||
"answer": "password_generator.py is created and satisfies the requirements.", | ||
"eval": { | ||
"type": "python" | ||
}, | ||
"files": [ | ||
"test_pwd.py" | ||
], | ||
"should_contain": [], | ||
"should_not_contain": [] | ||
}, | ||
"info": { | ||
"description": "Tests if the agent can create a random password generator.", | ||
"difficulty": "basic", | ||
"side_effects": [] | ||
}, | ||
"name": "PasswordGenerator", | ||
"task": "Create a random password generator. The password should have between 8 and 16 characters and should contain at least one letter, number and symbol. The password should be printed to the console. If no length is specified, the password should be 8 characters long. The password_generator should be imported as a module and called as password = password_generator.generate_password(length=x). Any invalid input should raise a ValueError." | ||
} |
41 changes: 41 additions & 0 deletions
41
...estbed/scenarios/AutoGPT/challenges/11_file_organizer/custom_python/test_file_organize.py
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,41 @@ | ||
import os | ||
import subprocess | ||
import tempfile | ||
import unittest | ||
|
||
|
||
class TestOrganizeFiles(unittest.TestCase): | ||
def setUp(self): | ||
# Create temporary directory | ||
self.test_dir = tempfile.mkdtemp() | ||
|
||
# File types and their corresponding directory | ||
self.file_types = { | ||
"test_image.png": "images", | ||
"test_doc.txt": "documents", | ||
"test_audio.mp3": "audio", | ||
} | ||
|
||
# Create test files | ||
for file_name in self.file_types.keys(): | ||
open(os.path.join(self.test_dir, file_name), "a").close() | ||
|
||
def test_organize_files(self): | ||
# Call the organize_files.py script using subprocess | ||
subprocess.call(["python", "organize_files.py", "--directory_path=" + self.test_dir]) | ||
|
||
# Check if the files have been moved to the correct directories | ||
for file_name, directory in self.file_types.items(): | ||
self.assertTrue(os.path.isfile(os.path.join(self.test_dir, directory, file_name))) | ||
|
||
def tearDown(self): | ||
# Delete test directory and its contents | ||
for file_name, directory in self.file_types.items(): | ||
os.remove(os.path.join(self.test_dir, directory, file_name)) | ||
for directory in set(self.file_types.values()): | ||
os.rmdir(os.path.join(self.test_dir, directory)) | ||
os.rmdir(self.test_dir) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Oops, something went wrong.