Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cake crusher/startup fixes #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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


# Generated Directories
data/
outputs/
generated_actions/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 8 additions & 1 deletion dynasaur.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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)