ecortese97 commited on
Commit
9d784ba
·
verified ·
1 Parent(s): 8bfa60d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -25
app.py CHANGED
@@ -19,33 +19,33 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
19
 
20
  return "What magic will you build ?"
21
 
22
- @tool
23
- def fetch_rss_feed(url: str) -> str:
24
- """Fetches the latest news articles from an RSS feed URL.
25
- Use this tool FIRST when the user asks for news, current events, or updates from a website.
26
- Prefer this over visit_webpage for news websites.
27
- Always use one of these URLs:
28
- - Italian news (ANSA): https://www.ansa.it/sito/notizie/topnews/topnews_rss.xml
29
- - Italian news (RaiNews): https://www.rainews.it/dl/rainews/media/feed-rainet.xml
30
- - World news (Reuters): https://feeds.reuters.com/reuters/topNews
31
- Args:
32
- url: The RSS feed URL to fetch.
33
- """
34
- import requests
35
- import xml.etree.ElementTree as ET
36
 
37
- response = requests.get(url, timeout=10)
38
- root = ET.fromstring(response.content)
39
 
40
- items = []
41
- for item in root.findall('.//item')[:10]: # prime 10 notizie
42
- title = item.findtext('title', '')
43
- desc = item.findtext('description', '')
44
- link = item.findtext('link', '')
45
- pub_date = item.findtext('pubDate', '')
46
- items.append(f"**{title}**\n{pub_date}\n{desc}\n{link}")
47
 
48
- return "\n\n---\n\n".join(items)
49
 
50
  @tool
51
  def get_current_time_in_timezone(timezone: str = 'Italy/Rome') -> str:
@@ -72,7 +72,6 @@ model = HfApiModel(
72
  max_tokens=2096,
73
  temperature=0.5,
74
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
75
- #model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
76
  custom_role_conversions=None,
77
  )
78
 
 
19
 
20
  return "What magic will you build ?"
21
 
22
+ # @tool
23
+ # def fetch_rss_feed(url: str) -> str:
24
+ # """Fetches the latest news articles from an RSS feed URL.
25
+ # Use this tool FIRST when the user asks for news, current events, or updates from a website.
26
+ # Prefer this over visit_webpage for news websites.
27
+ # Always use one of these URLs:
28
+ # - Italian news (ANSA): https://www.ansa.it/sito/notizie/topnews/topnews_rss.xml
29
+ # - Italian news (RaiNews): https://www.rainews.it/dl/rainews/media/feed-rainet.xml
30
+ # - World news (Reuters): https://feeds.reuters.com/reuters/topNews
31
+ # Args:
32
+ # url: The RSS feed URL to fetch.
33
+ # """
34
+ # import requests
35
+ # import xml.etree.ElementTree as ET
36
 
37
+ # response = requests.get(url, timeout=10)
38
+ # root = ET.fromstring(response.content)
39
 
40
+ # items = []
41
+ # for item in root.findall('.//item')[:10]: # prime 10 notizie
42
+ # title = item.findtext('title', '')
43
+ # desc = item.findtext('description', '')
44
+ # link = item.findtext('link', '')
45
+ # pub_date = item.findtext('pubDate', '')
46
+ # items.append(f"**{title}**\n{pub_date}\n{desc}\n{link}")
47
 
48
+ # return "\n\n---\n\n".join(items)
49
 
50
  @tool
51
  def get_current_time_in_timezone(timezone: str = 'Italy/Rome') -> str:
 
72
  max_tokens=2096,
73
  temperature=0.5,
74
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
 
75
  custom_role_conversions=None,
76
  )
77