mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-28 09:38:17 +00:00
Mapping required env vars of more tools (#353)
This commit is contained in:
@@ -5,13 +5,16 @@ Composio tools wrapper.
|
|||||||
import typing as t
|
import typing as t
|
||||||
|
|
||||||
import typing_extensions as te
|
import typing_extensions as te
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
|
|
||||||
|
|
||||||
class ComposioTool(BaseTool):
|
class ComposioTool(BaseTool):
|
||||||
"""Wrapper for composio tools."""
|
"""Wrapper for composio tools."""
|
||||||
|
|
||||||
composio_action: t.Callable
|
composio_action: t.Callable
|
||||||
|
env_vars: t.List[EnvVar] = [
|
||||||
|
EnvVar(name="COMPOSIO_API_KEY", description="API key for Composio services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def _run(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
|
def _run(self, *args: t.Any, **kwargs: t.Any) -> t.Any:
|
||||||
"""Run the composio action with given arguments."""
|
"""Run the composio action with given arguments."""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
from typing import Type
|
from typing import List, Type
|
||||||
|
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@@ -22,6 +22,10 @@ class DallETool(BaseTool):
|
|||||||
quality: str = "standard"
|
quality: str = "standard"
|
||||||
n: int = 1
|
n: int = 1
|
||||||
|
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="OPENAI_API_KEY", description="API key for OpenAI services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def _run(self, **kwargs) -> str:
|
def _run(self, **kwargs) -> str:
|
||||||
client = OpenAI()
|
client = OpenAI()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import Any, Optional, Type, List, TYPE_CHECKING
|
from typing import Any, Optional, Type, List, TYPE_CHECKING
|
||||||
|
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -61,6 +61,9 @@ class FirecrawlCrawlWebsiteTool(BaseTool):
|
|||||||
)
|
)
|
||||||
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
||||||
package_dependencies: List[str] = ["firecrawl-py"]
|
package_dependencies: List[str] = ["firecrawl-py"]
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="FIRECRAWL_API_KEY", description="API key for Firecrawl services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import Any, Optional, Type, Dict, List, TYPE_CHECKING
|
from typing import Any, Optional, Type, Dict, List, TYPE_CHECKING
|
||||||
|
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -56,6 +56,9 @@ class FirecrawlScrapeWebsiteTool(BaseTool):
|
|||||||
|
|
||||||
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
||||||
package_dependencies: List[str] = ["firecrawl-py"]
|
package_dependencies: List[str] = ["firecrawl-py"]
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="FIRECRAWL_API_KEY", description="API key for Firecrawl services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Type, List
|
from typing import TYPE_CHECKING, Any, Dict, Optional, Type, List
|
||||||
|
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -58,6 +58,9 @@ class FirecrawlSearchTool(BaseTool):
|
|||||||
)
|
)
|
||||||
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
||||||
package_dependencies: List[str] = ["firecrawl-py"]
|
package_dependencies: List[str] = ["firecrawl-py"]
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="FIRECRAWL_API_KEY", description="API key for Firecrawl services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
def __init__(self, api_key: Optional[str] = None, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Any, Optional, Type
|
from typing import Any, List, Optional, Type
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from crewai.tools import EnvVar
|
||||||
from crewai_tools.tools.rag.rag_tool import RagTool
|
from crewai_tools.tools.rag.rag_tool import RagTool
|
||||||
|
|
||||||
|
|
||||||
@@ -30,6 +31,9 @@ class SerplyJobSearchTool(RagTool):
|
|||||||
- Currently only supports US
|
- Currently only supports US
|
||||||
"""
|
"""
|
||||||
headers: Optional[dict] = {}
|
headers: Optional[dict] = {}
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="SERPLY_API_KEY", description="API key for Serply services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Any, Optional, Type
|
from typing import Any, List, Optional, Type
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
@@ -23,6 +23,9 @@ class SerplyNewsSearchTool(BaseTool):
|
|||||||
proxy_location: Optional[str] = "US"
|
proxy_location: Optional[str] = "US"
|
||||||
headers: Optional[dict] = {}
|
headers: Optional[dict] = {}
|
||||||
limit: Optional[int] = 10
|
limit: Optional[int] = 10
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="SERPLY_API_KEY", description="API key for Serply services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, limit: Optional[int] = 10, proxy_location: Optional[str] = "US", **kwargs
|
self, limit: Optional[int] = 10, proxy_location: Optional[str] = "US", **kwargs
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Any, Optional, Type
|
from typing import Any, List, Optional, Type
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
@@ -26,6 +26,9 @@ class SerplyScholarSearchTool(BaseTool):
|
|||||||
hl: Optional[str] = "us"
|
hl: Optional[str] = "us"
|
||||||
proxy_location: Optional[str] = "US"
|
proxy_location: Optional[str] = "US"
|
||||||
headers: Optional[dict] = {}
|
headers: Optional[dict] = {}
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="SERPLY_API_KEY", description="API key for Serply services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, hl: str = "us", proxy_location: Optional[str] = "US", **kwargs):
|
def __init__(self, hl: str = "us", proxy_location: Optional[str] = "US", **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Any, Optional, Type
|
from typing import Any, List, Optional, Type
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
from crewai.tools import EnvVar
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from crewai_tools.tools.rag.rag_tool import RagTool
|
from crewai_tools.tools.rag.rag_tool import RagTool
|
||||||
@@ -25,6 +26,9 @@ class SerplyWebpageToMarkdownTool(RagTool):
|
|||||||
request_url: str = "https://api.serply.io/v1/request"
|
request_url: str = "https://api.serply.io/v1/request"
|
||||||
proxy_location: Optional[str] = "US"
|
proxy_location: Optional[str] = "US"
|
||||||
headers: Optional[dict] = {}
|
headers: Optional[dict] = {}
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="SERPLY_API_KEY", description="API key for Serply services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, proxy_location: Optional[str] = "US", **kwargs):
|
def __init__(self, proxy_location: Optional[str] = "US", **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import base64
|
import base64
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, Type
|
from typing import List, Optional, Type
|
||||||
|
|
||||||
from crewai import LLM
|
from crewai import LLM
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from pydantic import BaseModel, PrivateAttr, field_validator
|
from pydantic import BaseModel, PrivateAttr, field_validator
|
||||||
|
|
||||||
|
|
||||||
@@ -44,6 +44,9 @@ class VisionTool(BaseTool):
|
|||||||
"This tool uses OpenAI's Vision API to describe the contents of an image."
|
"This tool uses OpenAI's Vision API to describe the contents of an image."
|
||||||
)
|
)
|
||||||
args_schema: Type[BaseModel] = ImagePromptSchema
|
args_schema: Type[BaseModel] = ImagePromptSchema
|
||||||
|
env_vars: List[EnvVar] = [
|
||||||
|
EnvVar(name="OPENAI_API_KEY", description="API key for OpenAI services", required=True),
|
||||||
|
]
|
||||||
|
|
||||||
_model: str = PrivateAttr(default="gpt-4o-mini")
|
_model: str = PrivateAttr(default="gpt-4o-mini")
|
||||||
_llm: Optional[LLM] = PrivateAttr(default=None)
|
_llm: Optional[LLM] = PrivateAttr(default=None)
|
||||||
|
|||||||
Reference in New Issue
Block a user