Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -29,12 +29,30 @@ co = cohere.Client(cohere_api_key)
|
|
29 |
# Define the DuckDuckGoSearch tool
|
30 |
@tool('DuckDuckGoSearchResults')
|
31 |
def search_results(search_query: str) -> dict:
|
32 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
return DuckDuckGoSearchResults(max_results=10).run(search_query)
|
34 |
|
35 |
@tool('WebScrapper')
|
36 |
def web_scrapper(url: str, topic: str) -> str:
|
37 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
# Scrape content from the specified URL
|
39 |
scraper = ScrapeWebsiteTool(website_url=url)
|
40 |
content = scraper.run()
|
|
|
29 |
# Define the DuckDuckGoSearch tool
|
30 |
@tool('DuckDuckGoSearchResults')
|
31 |
def search_results(search_query: str) -> dict:
|
32 |
+
"""
|
33 |
+
Performs a web search using the DuckDuckGo search engine to gather and return a collection of search results.
|
34 |
+
This tool automates the retrieval of web-based information related to a specified query.
|
35 |
+
Args:
|
36 |
+
- search_query (str): The query string that specifies the information to be searched on the web. This should be a clear and concise expression of the user's information needs.
|
37 |
+
Returns:
|
38 |
+
- list: A list of dictionaries, where each dictionary represents a search result. Each dictionary includes at least the 'title' of the page and the 'url' linking to it. Additional information such as a brief summary or snippet from the page might also be included depending on the specifics of the DuckDuckGo API response.
|
39 |
+
"""
|
40 |
return DuckDuckGoSearchResults(max_results=10).run(search_query)
|
41 |
|
42 |
@tool('WebScrapper')
|
43 |
def web_scrapper(url: str, topic: str) -> str:
|
44 |
+
"""
|
45 |
+
A tool designed to extract and read the content of a specified link and generate a summary on a specific topic.
|
46 |
+
It is capable of handling various types of web pages by making HTTP requests and parsing the received HTML content.
|
47 |
+
This tool uses Cohere's API to generate summaries, which can be particularly useful for web scraping tasks, data collection,
|
48 |
+
or extracting specific information from websites.
|
49 |
+
|
50 |
+
Args:
|
51 |
+
- url (str): The URL from which to scrape content.
|
52 |
+
- topic (str): The specific topic on which to generate a summary.
|
53 |
+
Returns:
|
54 |
+
- summary (str): summary of the url on the topic
|
55 |
+
"""
|
56 |
# Scrape content from the specified URL
|
57 |
scraper = ScrapeWebsiteTool(website_url=url)
|
58 |
content = scraper.run()
|