Sky-06's picture
TnR
8a2905d
Raw History Blame Contribute Delete
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."