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

Added save for agent config #35

Merged
merged 2 commits into from
Oct 11, 2024
Merged
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
9 changes: 9 additions & 0 deletions agent_app_sample_code/03_agent_proof_of_concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@

# COMMAND ----------

# MAGIC %md
# MAGIC ## Save the agent config

# COMMAND ----------

save_agent_config(agent_config.dict(), './agents/generated_configs/agent.yaml')

# COMMAND ----------

# MAGIC %md
# MAGIC ## Set the MLflow experiement name
# MAGIC
Expand Down
9 changes: 9 additions & 0 deletions agent_app_sample_code/agents/agent_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from pydantic import BaseModel
from typing import Literal, Any, List
import yaml
import os

# COMMAND ----------

Expand Down Expand Up @@ -86,3 +88,10 @@ class AgentConfig(BaseModel):

def validate_agent_config(config: dict) -> None:
AgentConfig.parse_obj(config)

def save_agent_config(config: dict, file_path: str) -> None:
# Ensure the directory exists
os.makedirs(os.path.dirname(file_path), exist_ok=True)

with open(file_path, 'w') as file:
yaml.dump(config, file)
40 changes: 0 additions & 40 deletions agent_app_sample_code/agents/generated_configs/agent.yaml

This file was deleted.

Loading