From cc0e0caebe3932ef444633360e65f192f7f087e7 Mon Sep 17 00:00:00 2001 From: Sebastian Sosa <1sebastian1sosa1@gmail.com> Date: Mon, 9 Dec 2024 18:43:52 -0500 Subject: [PATCH 1/5] ignore virtual env --- .gitignore | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80b83b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# Operating System Files +.DS_Store +Thumbs.db + +# IDE +.idea/ +.vscode/ + +# Python +__pycache__/ +*.py[cod] +*$py.class +.pytest_cache/ +.coverage +htmlcov/ + +# Virtual Environment +venv/ +env/ +ENV/ +.env +.venv + +# Distribution / packaging +dist/ +build/ +*.egg-info/ +*.egg + +# Jupyter Notebook +.ipynb_checkpoints + +# Logs +*.log \ No newline at end of file From 29d0c9ccd1b48ac5957eeb8b905a949b14e00b8c Mon Sep 17 00:00:00 2001 From: Sebastian Sosa <1sebastian1sosa1@gmail.com> Date: Wed, 11 Dec 2024 21:23:54 -0500 Subject: [PATCH 2/5] ignore generated directories --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 80b83b3..bdc1966 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,9 @@ build/ .ipynb_checkpoints # Logs -*.log \ No newline at end of file +*.log + + +# Generated Directories +data/ +generated_actions/ \ No newline at end of file From d516a709d09531e2a3f2e73d64bc6f010798b7dd Mon Sep 17 00:00:00 2001 From: Sebastian Sosa <1sebastian1sosa1@gmail.com> Date: Thu, 12 Dec 2024 00:15:15 -0500 Subject: [PATCH 3/5] dynamic model allowance --- README.md | 1 + dynasaur.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cddb2f8..de9d25b 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Empirically, DynaSaur exhibits remarkable versatility, recovering automatically AZURE_API_KEY="" AZURE_ENDPOINT="" AZURE_API_VERSION="" +AZURE_MODEL_NAME="" # Required: Keys for embeddings used in action retrieval EMBED_MODEL_TYPE="AzureOpenAI" diff --git a/dynasaur.py b/dynasaur.py index 3a9a1b8..0b97a15 100644 --- a/dynasaur.py +++ b/dynasaur.py @@ -107,10 +107,17 @@ def agent_call_function(agent, question: str, **kwargs) -> str: parser.add_argument("--generated_action_dir", type=str, default="generated_actions") parser.add_argument("--set", type=str, default="validation") parser.add_argument("--split", type=str, default="2023_level1") - parser.add_argument("--model_name", type=str, default="gpt-4o-2024-08-06") + parser.add_argument("--model_name", type=str, default=os.getenv("CHAT_COMPLETION_NAME")) parser.add_argument("--max_iterations", type=int, default=20) args = parser.parse_args() + if args.model_name is None: + raise ValueError("model_name is not set. You may either pass it as a command line argument or set the AZURE_MODEL_NAME environment variable.") + + + # print model_name + print("model_name:", args.model_name) + agent_name = f"{args.model_name}-{args.split}" generated_action_dir = os.path.join(args.generated_action_dir, agent_name) args.agent_name = agent_name From c525a027ff4e1a0077a40a0bdfc8b2861e32ace8 Mon Sep 17 00:00:00 2001 From: Sebastian Sosa <1sebastian1sosa1@gmail.com> Date: Thu, 12 Dec 2024 00:17:06 -0500 Subject: [PATCH 4/5] os agnostic env execution --- env.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/env.py b/env.py index 3f715ee..8fc514d 100644 --- a/env.py +++ b/env.py @@ -812,7 +812,7 @@ def step(self, code, language="Python", stream=False, display=False): # else: # state.result += content state.pwd = self.working_dir - state.ls = subprocess.run(['ls'], cwd=self.working_dir, capture_output=True, text=True).stdout + state.ls = list_directory(self.working_dir) return state # if ( @@ -918,3 +918,14 @@ def terminate(self): ): # Not sure why this is None sometimes. We should look into this language.terminate() del self._active_languages[language_name] + + +def list_directory(directory): + try: + # Get list of files and directories + items = os.listdir(directory) + # Format similar to ls/dir output + print("items:\n\n", '\n'.join(items)) + return '\n'.join(items) + except Exception as e: + return str(e) \ No newline at end of file From 7b6a79f14f2efc4dab1109d71052a7f7b0d8d94b Mon Sep 17 00:00:00 2001 From: Sebastian Sosa <1sebastian1sosa1@gmail.com> Date: Thu, 12 Dec 2024 00:17:50 -0500 Subject: [PATCH 5/5] gitignore generated outputs file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bdc1966..2cff3b0 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ build/ # Generated Directories data/ +outputs/ generated_actions/ \ No newline at end of file