mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 18:35:29 -04:00
b4b0c29169
Signed-off-by: -LAN- <laipz8200@outlook.com>
18 lines
598 B
Python
18 lines
598 B
Python
from typing import Any
|
|
|
|
from tools.google_search import GoogleSearchTool
|
|
|
|
from dify_plugin import ToolProvider
|
|
from dify_plugin.errors.tool import ToolProviderCredentialValidationError
|
|
|
|
|
|
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)) from e
|