dianamclean commited on
Commit
9e25632
·
verified ·
1 Parent(s): 227c812

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -22
app.py CHANGED
@@ -59,30 +59,18 @@ def get_things_todo(city: str) -> str:
59
 
60
  # Below is my attempt to use the structure provided
61
  @tool
62
- def my_ai_joke (arg1:str, arg2:int)-> str: #it's import to specify the return type
63
- #Keep this format for the description / args / args description but feel free to modify the tool
64
- """Generates an AI joke.
 
65
  Args:
66
- arg1: The topic of the joke.
67
- arg2: The temperature for joke generation (higher values = more creative, typically 0-10).
 
 
68
  """
69
- try:
70
- search_tool = DuckDuckGoSearchTool(arg1)
71
- results = search_tool.forward(
72
- f"Get a {joke} "
73
- )
74
-
75
- if results:
76
- top_result = results[0] # Assuming results is a list
77
- return top_result
78
- else:
79
- return "No results found."
80
- except requests.exceptions.RequestException as e:
81
- return f"Error: Failed to connect to the search. Details: {str(e)}"
82
- except Exception as e:
83
- return f"Error: An unexpected error occurred. Details: {str(e)}"#model.temperature = arg2
84
- # joke = joke(arg1, model.temperature) #return a joke about arg1
85
-
86
  return joke
87
 
88
  final_answer = FinalAnswerTool()
 
59
 
60
  # Below is my attempt to use the structure provided
61
  @tool
62
+ def my_ai_joke (arg1:str)-> str: #it's import to specify the return type
63
+ """
64
+ This is a tool that returns a joke
65
+
66
  Args:
67
+ args1: what kind of joke
68
+
69
+ Returns:
70
+ str: returns a joke
71
  """
72
+ search_tool = DuckDuckGoSearchTool()
73
+ print(search_tool("Tell me a joke"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  return joke
75
 
76
  final_answer = FinalAnswerTool()