Skip to content
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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Sekhar-Kumar-Dash
Copy link
Contributor

@Sekhar-Kumar-Dash Sekhar-Kumar-Dash commented Mar 11, 2024

Description

This PR integrated DuckDuckGO Zero click with MindsDB

Fixes #5642

Type of change

(Please delete options that are not relevant)

  • πŸ› Bug fix (non-breaking change which fixes an issue)
  • ⚑ New feature (non-breaking change which adds functionality)
  • πŸ“’ Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • πŸ“„ This change requires a documentation update

Verification Process

To ensure the changes are working as expected:

  • Test Location: Specify the URL or path for testing.
  • Verification Steps: Outline the steps or queries needed to validate the change. Include any data, configurations, or actions required to reproduce or see the new functionality.

Additional Media:

  • I have attached a brief loom video or screenshots showcasing the new functionality or change.

Screenshot (435)

Checklist:

  • My code follows the style guidelines(PEP 8) of MindsDB.
  • I have appropriately commented on my code, especially in complex areas.
  • Necessary documentation updates are either made or tracked in issues.
  • Relevant unit and integration tests are updated or added.

@Sekhar-Kumar-Dash Sekhar-Kumar-Dash changed the title Add files via upload Integrate DuckDuckgo Zero click with MindsDB Mar 11, 2024
@@ -0,0 +1 @@
requests
Copy link
Collaborator

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.

Copy link
Collaborator

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)
Copy link
Collaborator

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");
Copy link
Collaborator

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)
Copy link
Collaborator

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:
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Integration]: DuckDuckGo Zero Click Info API Integration
4 participants