ofermend commited on
Commit
7cc108b
1 Parent(s): ca7164b

update to vectara-agentic 0.1.8 and minor updates

Browse files
Files changed (3) hide show
  1. agent.py +9 -5
  2. app.py +1 -1
  3. requirements.txt +1 -1
agent.py CHANGED
@@ -47,8 +47,8 @@ def create_assistant_tools(cfg):
47
 
48
  # Tool to get the income statement for a given company and year using the FMP API
49
  def get_income_statement(
50
- ticker=Field(description="the ticker symbol of the company."),
51
- year=Field(description="the year for which to get the income statement."),
52
  ) -> str:
53
  """
54
  Get the income statement for a given company and year using the FMP (https://financialmodelingprep.com) API.
@@ -62,6 +62,8 @@ def create_assistant_tools(cfg):
62
  if response.status_code == 200:
63
  data = response.json()
64
  income_statement = pd.DataFrame(data)
 
 
65
  income_statement["date"] = pd.to_datetime(income_statement["date"])
66
  income_statement_specific_year = income_statement[
67
  income_statement["date"].dt.year == int(year)
@@ -92,7 +94,7 @@ def create_assistant_tools(cfg):
92
  n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.005,
93
  summary_num_results = 10,
94
  vectara_summarizer = 'vectara-summary-ext-24-05-med-omni',
95
- include_citations = False,
96
  )
97
 
98
  return (
@@ -105,13 +107,15 @@ def create_assistant_tools(cfg):
105
  ] +
106
  tools_factory.standard_tools() +
107
  tools_factory.financial_tools() +
108
- tools_factory.guardrail_tools() +
109
  [ask_transcripts]
110
  )
111
 
112
  def initialize_agent(_cfg, update_func=None):
113
  financial_bot_instructions = """
114
  - You are a helpful financial assistant, with expertise in financial reporting, in conversation with a user.
 
 
 
115
  - Respond in a compact format by using appropriate units of measure (e.g., K for thousands, M for millions, B for billions).
116
  Do not report the same number twice (e.g. $100K and 100,000 USD).
117
  - Always check the get_company_info and get_valid_years tools to validate company and year are valid.
@@ -124,7 +128,7 @@ def initialize_agent(_cfg, update_func=None):
124
  tools=create_assistant_tools(_cfg),
125
  topic="Financial data, annual reports and 10-K filings",
126
  custom_instructions=financial_bot_instructions,
127
- update_func=update_func
128
  )
129
  agent.report()
130
  return agent
 
47
 
48
  # Tool to get the income statement for a given company and year using the FMP API
49
  def get_income_statement(
50
+ ticker: str = Field(description="the ticker symbol of the company."),
51
+ year: int = Field(description="the year for which to get the income statement."),
52
  ) -> str:
53
  """
54
  Get the income statement for a given company and year using the FMP (https://financialmodelingprep.com) API.
 
62
  if response.status_code == 200:
63
  data = response.json()
64
  income_statement = pd.DataFrame(data)
65
+ if len(income_statement) == 0 or "date" not in income_statement.columns:
66
+ return "No data found for the given ticker symbol."
67
  income_statement["date"] = pd.to_datetime(income_statement["date"])
68
  income_statement_specific_year = income_statement[
69
  income_statement["date"].dt.year == int(year)
 
94
  n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.005,
95
  summary_num_results = 10,
96
  vectara_summarizer = 'vectara-summary-ext-24-05-med-omni',
97
+ include_citations = True,
98
  )
99
 
100
  return (
 
107
  ] +
108
  tools_factory.standard_tools() +
109
  tools_factory.financial_tools() +
 
110
  [ask_transcripts]
111
  )
112
 
113
  def initialize_agent(_cfg, update_func=None):
114
  financial_bot_instructions = """
115
  - You are a helpful financial assistant, with expertise in financial reporting, in conversation with a user.
116
+ - Use the ask_transcripts tool to answer most questions about the company's financial performance, risks, opportunities, competitors, and more.
117
+ - responses from ask_transcripts are summarized. You don't need to further summarize them.
118
+ - Use the get_income_statement tool only to receive financial data like revenue, net income, and other financial metrics for a specific company and year.
119
  - Respond in a compact format by using appropriate units of measure (e.g., K for thousands, M for millions, B for billions).
120
  Do not report the same number twice (e.g. $100K and 100,000 USD).
121
  - Always check the get_company_info and get_valid_years tools to validate company and year are valid.
 
128
  tools=create_assistant_tools(_cfg),
129
  topic="Financial data, annual reports and 10-K filings",
130
  custom_instructions=financial_bot_instructions,
131
+ update_func=update_func,
132
  )
133
  agent.report()
134
  return agent
app.py CHANGED
@@ -56,7 +56,7 @@ async def launch_bot():
56
  cfg = get_agent_config()
57
  st.session_state.cfg = cfg
58
  st.session_state.ex_prompt = None
59
- example_messages = [example.strip() for example in cfg.examples.split(",")] if cfg.examples else []
60
  st.session_state.example_messages = [em for em in example_messages if len(em)>0]
61
  reset()
62
 
 
56
  cfg = get_agent_config()
57
  st.session_state.cfg = cfg
58
  st.session_state.ex_prompt = None
59
+ example_messages = [example.strip() for example in cfg.examples.split(";")] if cfg.examples else []
60
  st.session_state.example_messages = [em for em in example_messages if len(em)>0]
61
  reset()
62
 
requirements.txt CHANGED
@@ -6,4 +6,4 @@ streamlit_feedback==0.1.3
6
  uuid==1.30
7
  langdetect==1.0.9
8
  langcodes==3.4.0
9
- vectara-agentic==0.1.7
 
6
  uuid==1.30
7
  langdetect==1.0.9
8
  langcodes==3.4.0
9
+ vectara-agentic==0.1.8