File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
src/openagi/actions/tools Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 12
12
13
13
class SearchApiSearch (BaseAction ):
14
14
"""SearchApi provides an easy to use API for querying web search engines and much more."""
15
- base_url = "https://www.searchapi.io/api/v1/search"
16
-
17
15
query : str = Field (
18
16
..., description = "User query of type string used to fetch web search results from a search engine."
19
17
)
@@ -31,14 +29,15 @@ def actions_validator(cls, engine):
31
29
return engine
32
30
33
31
def execute (self ):
32
+ base_url = "https://www.searchapi.io/api/v1/search"
34
33
searchapi_api_key = os .environ ["SEARCHAPI_API_KEY" ]
35
34
search_dict = {
36
35
"q" : self .query ,
37
36
"engine" : self .engine ,
38
37
"api_key" : searchapi_api_key
39
38
}
40
39
logging .debug (f"{ search_dict = } " )
41
- url = f"{ self . base_url } ?{ urlencode (search_dict )} "
40
+ url = f"{ base_url } ?{ urlencode (search_dict )} "
42
41
response = requests .request ("GET" , url )
43
42
json_response = response .json ()
44
43
You can’t perform that action at this time.
0 commit comments