Spaces:
Sleeping
Sleeping
Working on get_random_name tool
Browse files
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 |
-
|
|
|
|
| 47 |
|
| 48 |
except Exception as e:
|
| 49 |
-
return f"
|
| 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() ->
|
| 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() ->
|
| 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
|