mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-24 21:15:37 -04:00
17 lines
590 B
Python
17 lines
590 B
Python
from typing import Any
|
|
|
|
from dify_plugin import ToolProvider
|
|
from dify_plugin.errors.tool import ToolProviderCredentialValidationError
|
|
from tools.google_search import GoogleSearchTool
|
|
|
|
|
|
class GoogleProvider(ToolProvider):
|
|
def _validate_credentials(self, credentials: dict[str, Any]) -> None:
|
|
try:
|
|
for _ in GoogleSearchTool.from_credentials(credentials).invoke(
|
|
tool_parameters={"query": "test", "result_type": "link"},
|
|
):
|
|
pass
|
|
except Exception as e:
|
|
raise ToolProviderCredentialValidationError(str(e))
|