phspoden commited on
Commit
7cc484e
·
1 Parent(s): 7a3127c

Working on get_random_name tool

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -43,10 +43,11 @@ def get_random_name(nationality: str, page: int) -> str:
43
  # get the title and return it
44
  return data['items'][random_int]["title"]
45
  else:
46
- return f'Error - get_random_name() -> Response status code was not good ({response.status_code})'
 
47
 
48
  except Exception as e:
49
- return f"Error - get_random_name() -> Exception - Well this didn't work"
50
 
51
 
52
  @tool
@@ -67,7 +68,7 @@ def get_corporate_bullshit_text()-> str:
67
  return f'Error - get_corporate_bullshit_text() -> Response status code was not good ({response.status_code})'
68
 
69
  except Exception as e:
70
- return "Error - get_corporate_bullshit_text() -> Exception - Well this didn't work"
71
 
72
 
73
  @tool
@@ -88,7 +89,7 @@ def get_techy_phrases_text()-> str:
88
  return f'Error - get_techy_bullshit_text() -> Response status code was not good ({response.status_code})'
89
 
90
  except Exception as e:
91
- return "Error - get_techy_bullshit_text() -> Exception - Well this didn't work"
92
 
93
 
94
  @tool
 
43
  # get the title and return it
44
  return data['items'][random_int]["title"]
45
  else:
46
+ # returning Error message string in case of bad status code
47
+ return f'ERROR - get_random_name() -> Response status code: {response.status_code}. Response reason: {response.reason}'
48
 
49
  except Exception as e:
50
+ return f"ERROR - get_random_name() -> Exception: {e}"
51
 
52
 
53
  @tool
 
68
  return f'Error - get_corporate_bullshit_text() -> Response status code was not good ({response.status_code})'
69
 
70
  except Exception as e:
71
+ return f"Error - get_corporate_bullshit_text() -> -> Exception: {e}"
72
 
73
 
74
  @tool
 
89
  return f'Error - get_techy_bullshit_text() -> Response status code was not good ({response.status_code})'
90
 
91
  except Exception as e:
92
+ return f"Error - get_techy_bullshit_text() -> -> Exception: {e}"
93
 
94
 
95
  @tool