Skip to content

Commit

Permalink
Added save for agent config (#35)
Browse files Browse the repository at this point in the history
* Added save for agent config

* Removed default agent config file
edurdevic authored Oct 11, 2024
1 parent 6836bb4 commit 9c00212
Showing 3 changed files with 18 additions and 40 deletions.
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
@@ -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
9 changes: 9 additions & 0 deletions agent_app_sample_code/agents/agent_config.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@

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

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

@@ -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.

0 comments on commit 9c00212

Please sign in to comment.