Skip to content

Commit

Permalink
make engine configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifertrj committed Nov 29, 2024
1 parent 44f21ce commit 300a2d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/openagi/actions/tools/searchapi_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@ def _check_deprecated_usage(self):
if 'SEARCHAPI_API_KEY' in os.environ and not self.get_config('api_key'):
warnings.warn(
"Using environment variables for API keys is deprecated and will be removed in a future version. "
"Please use SearchApiSearch.set_config(api_key='your_key') instead of setting environment variables.",
"Please use SearchApiSearch.set_config(api_key='your_key', engine='google') instead of setting environment variables.",
DeprecationWarning,
stacklevel=2
)
self.set_config(api_key=os.environ['SEARCHAPI_API_KEY'])
self.set_config(api_key=os.environ['SEARCHAPI_API_KEY'], engine='google')

def execute(self):
base_url = "https://www.searchapi.io/api/v1/search"
api_key = self.get_config('api_key')
engine = self.get_config('engine', 'google') # Default to google if not set

search_dict = {
"q": self.query,
"engine": "google",
"engine": engine,
"api_key": api_key
}

Expand Down

0 comments on commit 300a2d3

Please sign in to comment.