forked from ComposioHQ/composio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.py
More file actions
22 lines (17 loc) · 666 Bytes
/
tools.py
File metadata and controls
22 lines (17 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import typing as t
from typing import Type
from praisonai_tools import BaseTool
from composio_praisonai import ComposioToolSet
from langchain.pydantic_v1 import BaseModel, Field
class SERPAPI_SEARCH_PARAMS(BaseModel):
query: str = Field(description="The search query for the SERP API.")
class SERPAPI_SEARCH_TOOL(BaseTool):
name: str = "SERPAPI_SEARCH_TOOL"
description: str = "Perform a Google search using the SERP API."
args_schema: Type[BaseModel] = SERPAPI_SEARCH_PARAMS
def _run(self, **kwargs: t.Any) -> t.Any:
toolset = ComposioToolSet(entity_id='default')
return toolset.execute_tool(
tool_identifier="serpapi_search",
params=kwargs,
)