keenanjt commited on
Commit
a103c82
·
verified ·
1 Parent(s): 9342659

created a get_user_input function

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -33,6 +33,19 @@ def get_current_time_in_timezone(timezone: str) -> str:
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  final_answer = FinalAnswerTool()
38
  web_search = DuckDuckGoSearchTool()
@@ -57,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
57
 
58
  agent = CodeAgent(
59
  model=model,
60
- tools=[final_answer, web_search, get_current_time_in_timezone, input()], ## add your tools here (don't remove final answer)
61
  max_steps=6,
62
  verbosity_level=1,
63
  grammar=None,
 
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
+ @tool
37
+ def get_user_input(user_input: str) -> str:
38
+ """A tool that ask the user for input, so you can use that input for other functions
39
+ Args:
40
+ user_input: A string representing their input
41
+ """
42
+ try:
43
+ user_input = input("Enter something: ")
44
+ # Process the input
45
+ return user_input
46
+ except EOFError:
47
+ return ("End of input reached.")
48
+
49
 
50
  final_answer = FinalAnswerTool()
51
  web_search = DuckDuckGoSearchTool()
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[final_answer, web_search, get_current_time_in_timezone,get_user_input], ## add your tools here (don't remove final answer)
74
  max_steps=6,
75
  verbosity_level=1,
76
  grammar=None,