WilliamGazeley commited on
Commit
d8a7106
·
1 Parent(s): 7c1f337

Fix analysis function calls

Browse files
src/functioncall.py CHANGED
@@ -135,7 +135,7 @@ class ModelInference:
135
  depth += 1
136
  if depth >= max_depth:
137
  print(f"Maximum recursion depth reached ({max_depth}). Stopping recursion.")
138
- return
139
 
140
  completion = self.run_inference(prompt)
141
  return recursive_loop(prompt, completion, depth)
 
135
  depth += 1
136
  if depth >= max_depth:
137
  print(f"Maximum recursion depth reached ({max_depth}). Stopping recursion.")
138
+ return
139
 
140
  completion = self.run_inference(prompt)
141
  return recursive_loop(prompt, completion, depth)
src/functions.py CHANGED
@@ -10,6 +10,7 @@ from bs4 import BeautifulSoup
10
  from utils import inference_logger
11
  from langchain.tools import tool
12
  from langchain_core.utils.function_calling import convert_to_openai_tool
 
13
 
14
  from azure.core.credentials import AzureKeyCredential
15
  from azure.search.documents import SearchClient
@@ -22,7 +23,8 @@ az_search_client = SearchClient(config.az_search_endpoint, config.az_search_idx_
22
  def get_company_analysis(query: str) -> dict:
23
  """
24
  Searches through your database of company and crypto analysis, retrieves top 2
25
- pieces of analysis relevant to your query.
 
26
 
27
  Args:
28
  query (str): The search query
@@ -286,7 +288,7 @@ def get_openai_tools() -> List[dict]:
286
  get_stock_fundamentals,
287
  get_financial_statements,
288
  get_key_financial_ratios,
289
- get_analyst_recommendations,
290
  get_dividend_data,
291
  get_technical_indicators
292
  ]
 
10
  from utils import inference_logger
11
  from langchain.tools import tool
12
  from langchain_core.utils.function_calling import convert_to_openai_tool
13
+ from config import config
14
 
15
  from azure.core.credentials import AzureKeyCredential
16
  from azure.search.documents import SearchClient
 
23
  def get_company_analysis(query: str) -> dict:
24
  """
25
  Searches through your database of company and crypto analysis, retrieves top 2
26
+ pieces of analysis relevant to your query. You MUST ALWAYS use this function
27
+ to help form your opinions and predictions.
28
 
29
  Args:
30
  query (str): The search query
 
288
  get_stock_fundamentals,
289
  get_financial_statements,
290
  get_key_financial_ratios,
291
+ # get_analyst_recommendations,
292
  get_dividend_data,
293
  get_technical_indicators
294
  ]
src/prompt_assets/output_sys_prompt.yml CHANGED
@@ -4,6 +4,7 @@ Role: |
4
  You can use information given to you, but do not mention function calls.
5
  Objective: |
6
  Answer questions accurately and truthfully given your current knowledge. Answer the question directly.
 
7
  Instructions: |
8
  The questions will be asked by top technology executives and CFO of large fintech companies and successful startups.
9
  Answer in a friendly and engaging manner representing a top female investment professional working at a leading investment bank.
 
4
  You can use information given to you, but do not mention function calls.
5
  Objective: |
6
  Answer questions accurately and truthfully given your current knowledge. Answer the question directly.
7
+ Your purpose is to give financial advice and indepth analysis.
8
  Instructions: |
9
  The questions will be asked by top technology executives and CFO of large fintech companies and successful startups.
10
  Answer in a friendly and engaging manner representing a top female investment professional working at a leading investment bank.
src/prompt_assets/sys_prompt.yml CHANGED
@@ -27,6 +27,7 @@ Schema: |
27
  Use the following pydantic model json schema for each tool call you will make:
28
  {schema}
29
  Instructions: |
 
30
  At the very first turn you don't have <tool_results> so you shouldn't not make up the results.
31
  Please keep a running summary with analysis of previous function results and summaries from previous iterations.
32
  Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10.
 
27
  Use the following pydantic model json schema for each tool call you will make:
28
  {schema}
29
  Instructions: |
30
+ If the user asks for an opinion, you must use functions to form your opinion
31
  At the very first turn you don't have <tool_results> so you shouldn't not make up the results.
32
  Please keep a running summary with analysis of previous function results and summaries from previous iterations.
33
  Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10.