James MacQuillan commited on
Commit
2222caa
·
1 Parent(s): 32faf89
Files changed (2) hide show
  1. app.py +5 -2
  2. websites.csv +0 -0
app.py CHANGED
@@ -377,7 +377,7 @@ def json_to_text(json_data):
377
  def detect_data_request(user_input, history):
378
  youreq = user_input
379
 
380
-
381
  # Get the response from the model (no streaming)
382
  response = client.chat_completion(
383
  model="Qwen/Qwen2.5-72B-Instruct",
@@ -393,11 +393,12 @@ def detect_data_request(user_input, history):
393
 
394
  if first_resp == 'yes':
395
  try:
 
396
  # Fetch data from the provided API endpoint
397
  requestfromfp = requests.get(url_resp)
398
  requestfromfp.raise_for_status() # Check for request errors
399
  jsoned_data = requestfromfp.json()
400
-
401
  # Convert the JSON response into human-readable text
402
  human_readable_text = json_to_text(jsoned_data)
403
  stringed_text = str(human_readable_text)
@@ -432,6 +433,7 @@ def detect_data_request(user_input, history):
432
  if "yes" in full_response.lower():
433
  url = full_response[3:] # Extract the URL part
434
  try:
 
435
  request = requests.get(url)
436
  request.raise_for_status()
437
 
@@ -455,6 +457,7 @@ def detect_data_request(user_input, history):
455
  history.append(("You: " + user_input, f"IM.B: Error fetching URL: {e}"))
456
 
457
  else:
 
458
  response = client.chat_completion(
459
  model="mistralai/Mistral-7B-Instruct-v0.3",
460
  messages=[{"role": "user", "content": f"you are IM.B, an intelligent investing AI model built by automatedstockmining.org however you answer whatever the user requests, answer this question as IM.B, {youreq}, tell the user that you have access to real time data so that if they want some real time data, just ask for it"}],
 
377
  def detect_data_request(user_input, history):
378
  youreq = user_input
379
 
380
+ gr.Info('thinking about how to respond')
381
  # Get the response from the model (no streaming)
382
  response = client.chat_completion(
383
  model="Qwen/Qwen2.5-72B-Instruct",
 
393
 
394
  if first_resp == 'yes':
395
  try:
396
+
397
  # Fetch data from the provided API endpoint
398
  requestfromfp = requests.get(url_resp)
399
  requestfromfp.raise_for_status() # Check for request errors
400
  jsoned_data = requestfromfp.json()
401
+ gr.Info('located an endpoint and retrieving and processing the data you want')
402
  # Convert the JSON response into human-readable text
403
  human_readable_text = json_to_text(jsoned_data)
404
  stringed_text = str(human_readable_text)
 
433
  if "yes" in full_response.lower():
434
  url = full_response[3:] # Extract the URL part
435
  try:
436
+ gr.Info('searching the web sites that may contain the dat you want')
437
  request = requests.get(url)
438
  request.raise_for_status()
439
 
 
457
  history.append(("You: " + user_input, f"IM.B: Error fetching URL: {e}"))
458
 
459
  else:
460
+ gr.Info('getting your response ready')
461
  response = client.chat_completion(
462
  model="mistralai/Mistral-7B-Instruct-v0.3",
463
  messages=[{"role": "user", "content": f"you are IM.B, an intelligent investing AI model built by automatedstockmining.org however you answer whatever the user requests, answer this question as IM.B, {youreq}, tell the user that you have access to real time data so that if they want some real time data, just ask for it"}],
websites.csv ADDED
File without changes