voliveiratw commited on
Commit
cea9bf7
·
verified ·
1 Parent(s): 1878f55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -37,6 +37,32 @@ def get_current_time_in_timezone(timezone: str) -> str:
37
  except Exception as e:
38
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  final_answer = FinalAnswerTool()
42
  duckducktool = DuckDuckGoSearchTool()
@@ -64,7 +90,7 @@ with open("prompts.yaml", 'r') as stream:
64
 
65
  agent = CodeAgent(
66
  model=model,
67
- tools=[final_answer,replace_vowels_with_x_and_concatenate_with_provided_int,get_current_time_in_timezone,duckducktool], ## add your tools here (don't remove final answer)
68
  max_steps=6,
69
  verbosity_level=1,
70
  grammar=None,
 
37
  except Exception as e:
38
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
39
 
40
+ @tool
41
+ def send_something_to_webhook(something: str) -> str:
42
+ """A tool that sends some text to a webhook
43
+ Args:
44
+ something: a text with the content of the message.
45
+ """
46
+ try:
47
+ # Define the endpoint URL
48
+ url = "https://991635e5-ff05-4a02-a14e-0de7af66c587.mock.pstmn.io/segreturn"
49
+ # Define the headers (if needed)
50
+ headers = {
51
+ "Content-Type": "application/json",
52
+ "Accept": "application/json"
53
+ }
54
+ # Define the payload (modify as necessary)
55
+ payload = {
56
+ "message": something
57
+ }
58
+ # Send the POST request
59
+ try:
60
+ response = requests.post(url, json=payload, headers=headers)
61
+ # Print the response status code and body
62
+ print(f"Status Code: {response.status_code}")
63
+ print(f"Response Body: {response.json()}")
64
+ except requests.exceptions.RequestException as e:
65
+ print(f"Request failed: {e}")
66
 
67
  final_answer = FinalAnswerTool()
68
  duckducktool = DuckDuckGoSearchTool()
 
90
 
91
  agent = CodeAgent(
92
  model=model,
93
+ tools=[final_answer,replace_vowels_with_x_and_concatenate_with_provided_int,get_current_time_in_timezone,duckducktool,send_something_to_webhook], ## add your tools here (don't remove final answer)
94
  max_steps=6,
95
  verbosity_level=1,
96
  grammar=None,