Spaces:
Runtime error
Runtime error
Download tools.py from Sky-06/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/spaces/Sky-06/Final_Assignment_Template/resolve/main/tools.py
- Command line
-
hf download hf://spaces/Sky-06/Final_Assignment_Template/tools.py
-
curl -L -o tools.py https://huggingface.co/spaces/Sky-06/Final_Assignment_Template/resolve/main/tools.py
2.23 kB
| from smolagents import DuckDuckGoSearchTool | |
| from smolagents import Tool | |
| import random | |
| from huggingface_hub import list_models | |
| search_tool = DuckDuckGoSearchTool() | |
| class WebSearchTool(Tool): | |
| name = "web_search" | |
| description = "Useful for searching the web for information relevant to the question. " | |
| inputs = { | |
| "query": { | |
| "type": "string", | |
| "description": "The search query string.", | |
| } | |
| } | |
| output_type = "string" | |
| def forward(self, query: str) -> str: | |
| return search_tool.forward(query) | |
| class NasaImageSearchTool(Tool): | |
| name = "nasa_image_search" | |
| description = "Useful for searching NASA's image library for relevant images. " | |
| inputs = { | |
| "query": { | |
| "type": "string", | |
| "description": "The search query string.", | |
| } | |
| } | |
| output_type = "string" | |
| def forward(self, query: str) -> str: | |
| # This is a placeholder implementation. You would replace this with actual API calls to NASA's image search. | |
| return f"Image results for '{query}' from NASA's image library." | |
| class ClinicalTrialsSearchTool(Tool): | |
| name = "clinical_trials_search" | |
| description = "Useful for searching clinical trial databases for relevant studies. " | |
| inputs = { | |
| "query": { | |
| "type": "string", | |
| "description": "The search query string.", | |
| } | |
| } | |
| output_type = "string" | |
| def forward(self, query: str) -> str: | |
| # This is a placeholder implementation. You would replace this with actual API calls to clinical trial databases. | |
| return f"Clinical trial results for '{query}' from clinical trial databases." | |
| class WikipediaSearchTool(Tool): | |
| name = "wikipedia_search" | |
| description = "Useful for searching Wikipedia for relevant information. " | |
| inputs = { | |
| "query": { | |
| "type": "string", | |
| "description": "The search query string.", | |
| } | |
| } | |
| output_type = "string" | |
| def forward(self, query: str) -> str: | |
| # This is a placeholder implementation. You would replace this with actual API calls to Wikipedia's search. | |
| return f"Wikipedia results for '{query}' from Wikipedia's search." |