Commit
·
47ebf49
1
Parent(s):
e676e70
update tool
Browse files
tool.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
from typing import Any, Literal, Optional
|
2 |
from smolagents.tools import Tool
|
3 |
-
import linkup
|
4 |
|
5 |
class LinkupSearchTool(Tool):
|
6 |
"""LinkupSearchTool tool.
|
@@ -33,6 +32,15 @@ Args:
|
|
33 |
description = "Performs an online search using Linkup search engine and retrieves the top results as a string. This function is useful for accessing real-time information, including news, articles, and other relevant web content."
|
34 |
output_type = "string"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
def __init__(self, linkup_api_key: str | None = None) -> None:
|
37 |
super().__init__()
|
38 |
try:
|
@@ -42,15 +50,6 @@ Args:
|
|
42 |
"You must install package `linkup-sdk` to run this tool: for instance run `pip install linkup-sdk`."
|
43 |
) from e
|
44 |
|
45 |
-
self.inputs = {
|
46 |
-
"query": {"type": "string", "description": "The search query to perform."},
|
47 |
-
"depth": {
|
48 |
-
"type": "string",
|
49 |
-
"enum": ["standard", "deep"],
|
50 |
-
"description": "The search depth to perform. Use 'standard' for straightforward queries with likely direct answers (e.g., facts, definitions, simple explanations). Use 'deep' for: 1) complex queries requiring comprehensive analysis or information synthesis, 2) queries containing uncommon terms, specialized jargon, or abbreviations that may need additional context, or 3) questions likely requiring up-to-date or specialized web search results to answer effectively.",
|
51 |
-
},
|
52 |
-
}
|
53 |
-
|
54 |
self.client = LinkupClient(api_key=linkup_api_key)
|
55 |
|
56 |
def forward(self, query: str, depth: str) -> str:
|
|
|
1 |
from typing import Any, Literal, Optional
|
2 |
from smolagents.tools import Tool
|
|
|
3 |
|
4 |
class LinkupSearchTool(Tool):
|
5 |
"""LinkupSearchTool tool.
|
|
|
32 |
description = "Performs an online search using Linkup search engine and retrieves the top results as a string. This function is useful for accessing real-time information, including news, articles, and other relevant web content."
|
33 |
output_type = "string"
|
34 |
|
35 |
+
inputs = {
|
36 |
+
"query": {"type": "string", "description": "The search query to perform."},
|
37 |
+
"depth": {
|
38 |
+
"type": "string",
|
39 |
+
"enum": ["standard", "deep"],
|
40 |
+
"description": "The search depth to perform. Use 'standard' for straightforward queries with likely direct answers (e.g., facts, definitions, simple explanations). Use 'deep' for: 1) complex queries requiring comprehensive analysis or information synthesis, 2) queries containing uncommon terms, specialized jargon, or abbreviations that may need additional context, or 3) questions likely requiring up-to-date or specialized web search results to answer effectively.",
|
41 |
+
},
|
42 |
+
}
|
43 |
+
|
44 |
def __init__(self, linkup_api_key: str | None = None) -> None:
|
45 |
super().__init__()
|
46 |
try:
|
|
|
50 |
"You must install package `linkup-sdk` to run this tool: for instance run `pip install linkup-sdk`."
|
51 |
) from e
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
self.client = LinkupClient(api_key=linkup_api_key)
|
54 |
|
55 |
def forward(self, query: str, depth: str) -> str:
|