From a3c0f4b871e2e6ac57d6da0240d8fde7b2a8b7c8 Mon Sep 17 00:00:00 2001 From: Andrei Fajardo Date: Wed, 31 Jul 2024 15:55:38 -0400 Subject: [PATCH] remove pw --- .../goods_getter_agent.py | 19 +++++++++++++------ .../time_series_getter_agent.py | 12 ++++++++---- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/goods_getter_agent.py b/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/goods_getter_agent.py index a4d3d2d..2741598 100644 --- a/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/goods_getter_agent.py +++ b/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/goods_getter_agent.py @@ -15,6 +15,10 @@ control_plane_port = load_from_env("CONTROL_PLANE_PORT") funny_agent_host = load_from_env("FUNNY_AGENT_HOST") funny_agent_port = load_from_env("FUNNY_AGENT_PORT") +snowflake_user = load_from_env("SNOWFLAKE_USERNAME") +snowflake_password = load_from_env("SNOWFLAKE_PASSWORD") +snowflake_account = load_from_env("SNOWFLAKE_ACCOUNT") +snowflake_role = load_from_env("SNOWFLAKE_ROLE") localhost = load_from_env("LOCALHOST") @@ -46,13 +50,13 @@ def get_list_of_candidate_goods(good: str) -> str: The list of goods is represented as a string separated by '\n'.""" query = SQL_QUERY_TEMPLATE.format(good=good) url = URL( - account="AZXOMEC-NZB11223", - user="NERDAILLAMAINDEX", - password="b307gJ5YzR8k", + account=snowflake_account, + user=snowflake_user, + password=snowflake_password, database="FINANCIAL__ECONOMIC_ESSENTIALS", schema="CYBERSYN", warehouse="COMPUTE_WH", - role="ACCOUNTADMIN", + role=snowflake_role, ) engine = create_engine(url) @@ -63,13 +67,16 @@ def get_list_of_candidate_goods(good: str) -> str: connection.close() # process - results = [str(el[0]) for el in results] + results = [f"{ix+1}. {str(el[0])}" for ix, el in enumerate(results)] + results_str = "List of goods that exist in the database:\n\n" results_str = "\n".join(results) return results_str -goods_getter_tool = FunctionTool.from_defaults(fn=get_list_of_candidate_goods) +goods_getter_tool = FunctionTool.from_defaults( + fn=get_list_of_candidate_goods, return_direct=True +) agent = OpenAIAgent.from_tools( [goods_getter_tool], system_prompt=AGENT_SYSTEM_PROMPT, diff --git a/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/time_series_getter_agent.py b/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/time_series_getter_agent.py index 24905db..cea6a71 100644 --- a/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/time_series_getter_agent.py +++ b/snowflake_cybersyn_demo/agent_services/financial_and_economic_essentials/time_series_getter_agent.py @@ -18,6 +18,10 @@ control_plane_port = load_from_env("CONTROL_PLANE_PORT") funny_agent_host = load_from_env("FUNNY_AGENT_HOST") funny_agent_port = load_from_env("FUNNY_AGENT_PORT") +snowflake_user = load_from_env("SNOWFLAKE_USERNAME") +snowflake_password = load_from_env("SNOWFLAKE_PASSWORD") +snowflake_account = load_from_env("SNOWFLAKE_ACCOUNT") +snowflake_role = load_from_env("SNOWFLAKE_ROLE") localhost = load_from_env("LOCALHOST") @@ -69,13 +73,13 @@ def get_time_series_of_good(good: str) -> str: """Create a time series of the average price paid for a good nationwide starting in 2021.""" query = SQL_QUERY_TEMPLATE.format(good=good) url = URL( - account="AZXOMEC-NZB11223", - user="NERDAILLAMAINDEX", - password="b307gJ5YzR8k", + account=snowflake_account, + user=snowflake_user, + password=snowflake_password, database="FINANCIAL__ECONOMIC_ESSENTIALS", schema="CYBERSYN", warehouse="COMPUTE_WH", - role="ACCOUNTADMIN", + role=snowflake_role, ) engine = create_engine(url)