ofermend commited on
Commit
f8d2846
1 Parent(s): c4c6f1c
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -32,7 +32,7 @@ tickers = {
32
  years = [2020, 2021, 2022, 2023, 2024]
33
  initial_prompt = "How can I help you today?"
34
 
35
- def create_tools(cfg):
36
 
37
  def get_company_info() -> list[str]:
38
  """
@@ -99,13 +99,14 @@ def create_tools(cfg):
99
  include_citations = False,
100
  )
101
 
102
- return (tools_factory.get_tools(
 
103
  [
104
  get_company_info,
105
  get_valid_years,
106
  get_income_statement,
107
  ]
108
- ) +
109
  tools_factory.standard_tools() +
110
  tools_factory.financial_tools() +
111
  tools_factory.guardrail_tools() +
@@ -118,10 +119,10 @@ def initialize_agent(_cfg):
118
 
119
  financial_bot_instructions = """
120
  - You are a helpful financial assistant, with expertise in financial reporting, in conversation with a user.
121
- - Never discuss politics, and always respond politely.
122
  - Respond in a compact format by using appropriate units of measure (e.g., K for thousands, M for millions, B for billions).
123
  Do not report the same number twice (e.g. $100K and 100,000 USD).
124
  - Always check the get_company_info and get_valid_years tools to validate company and year are valid.
 
125
  - When querying a tool for a numeric value or KPI, use a concise and non-ambiguous description of what you are looking for.
126
  - If you calculate a metric, make sure you have all the necessary information to complete the calculation. Don't guess.
127
  """
@@ -132,7 +133,7 @@ def initialize_agent(_cfg):
132
  st.session_state.log_messages.append(output)
133
 
134
  agent = Agent(
135
- tools=create_tools(_cfg),
136
  topic="Financial data, annual reports and 10-K filings",
137
  custom_instructions=financial_bot_instructions,
138
  update_func=update_func
 
32
  years = [2020, 2021, 2022, 2023, 2024]
33
  initial_prompt = "How can I help you today?"
34
 
35
+ def create_assistant_tools(cfg):
36
 
37
  def get_company_info() -> list[str]:
38
  """
 
99
  include_citations = False,
100
  )
101
 
102
+ return (
103
+ [tools_factory.create_tool(tool) for tool in
104
  [
105
  get_company_info,
106
  get_valid_years,
107
  get_income_statement,
108
  ]
109
+ ] +
110
  tools_factory.standard_tools() +
111
  tools_factory.financial_tools() +
112
  tools_factory.guardrail_tools() +
 
119
 
120
  financial_bot_instructions = """
121
  - You are a helpful financial assistant, with expertise in financial reporting, in conversation with a user.
 
122
  - Respond in a compact format by using appropriate units of measure (e.g., K for thousands, M for millions, B for billions).
123
  Do not report the same number twice (e.g. $100K and 100,000 USD).
124
  - Always check the get_company_info and get_valid_years tools to validate company and year are valid.
125
+ - Do not include URLS unless they are from one of the tools.
126
  - When querying a tool for a numeric value or KPI, use a concise and non-ambiguous description of what you are looking for.
127
  - If you calculate a metric, make sure you have all the necessary information to complete the calculation. Don't guess.
128
  """
 
133
  st.session_state.log_messages.append(output)
134
 
135
  agent = Agent(
136
+ tools=create_assistant_tools(_cfg),
137
  topic="Financial data, annual reports and 10-K filings",
138
  custom_instructions=financial_bot_instructions,
139
  update_func=update_func