-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate DuckDuckgo Zero click with MindsDB #8903
base: main
Are you sure you want to change the base?
Conversation
mindsdb/integrations/handlers/duckduckgozeroclick_handler/duckduckgozeroclick_handler.py
Outdated
Show resolved
Hide resolved
mindsdb/integrations/handlers/duckduckgozeroclick_handler/duckduckgozeroclick_handler.py
Show resolved
Hide resolved
mindsdb/integrations/handlers/duckduckgozeroclick_handler/duckduckgozeroclick_handler.py
Outdated
Show resolved
Hide resolved
@@ -0,0 +1 @@ | |||
requests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requests
is part of the base dependencies for MindsDB, therefore, it does not need to be included here. If this is the only dependency for the handler, we can remove this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, please find a 40x40 (px) SVG for the icon. Either way a SVG is preferred. If you do change it, please remember to update icon_path
in the __init__.py
file as well.
self.api_key = args['api_key'] | ||
|
||
duckduckgo_search_table = DuckDuckGoSearchTable(self) | ||
self._register_table("my_duckduckgo", duckduckgo_search_table) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the name of this table to search
.
|
||
Now, you can use this established connection to query your database as follows: | ||
```sql | ||
SELECT * FROM my_duckduckgo("MindsDB"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct syntax for running SELECT
queries. It should be something like this,
SELECT * FROM my_duckduckgo.<table_name>
WHERE <column_name> = 'MindsDB'
pd.DataFrame: The search results as a pandas DataFrame. | ||
""" | ||
|
||
match = re.search(r"from\s+my_duckduckgo\s*\(\s*['\"](.*?)['\"]\s*\)", str(query), re.IGNORECASE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way that the query is being parsed here does not seem to be correct; you need to break the query into its component parts such as the SELECT
, WHERE
and LIMIT
clauses.
There are some utilities here that can help you with this.
self.is_connected = True if self.is_connected else False | ||
return self.api_key or None | ||
|
||
def check_connection(self) -> StatusResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check if the connection can be established here. For example, by sending a simple request and checking if is successful.
Description
This PR integrated DuckDuckGO Zero click with MindsDB
Fixes #5642
Type of change
(Please delete options that are not relevant)
Verification Process
To ensure the changes are working as expected:
Additional Media:
Checklist: