mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 16:48:30 +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_extensions as te
|
||||
from crewai.tools import BaseTool
|
||||
from crewai.tools import BaseTool, EnvVar
|
||||
|
||||
|
||||
class ComposioTool(BaseTool):
|
||||
"""Wrapper for composio tools."""
|
||||
|
||||
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:
|
||||
"""Run the composio action with given arguments."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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 pydantic import BaseModel, Field
|
||||
|
||||
@@ -22,6 +22,10 @@ class DallETool(BaseTool):
|
||||
quality: str = "standard"
|
||||
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:
|
||||
client = OpenAI()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -61,6 +61,9 @@ class FirecrawlCrawlWebsiteTool(BaseTool):
|
||||
)
|
||||
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
||||
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):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -56,6 +56,9 @@ class FirecrawlScrapeWebsiteTool(BaseTool):
|
||||
|
||||
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
||||
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):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -58,6 +58,9 @@ class FirecrawlSearchTool(BaseTool):
|
||||
)
|
||||
_firecrawl: Optional["FirecrawlApp"] = PrivateAttr(None)
|
||||
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):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import os
|
||||
from typing import Any, Optional, Type
|
||||
from typing import Any, List, Optional, Type
|
||||
from urllib.parse import urlencode
|
||||
|
||||
import requests
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from crewai.tools import EnvVar
|
||||
from crewai_tools.tools.rag.rag_tool import RagTool
|
||||
|
||||
|
||||
@@ -30,6 +31,9 @@ class SerplyJobSearchTool(RagTool):
|
||||
- Currently only supports US
|
||||
"""
|
||||
headers: Optional[dict] = {}
|
||||
env_vars: List[EnvVar] = [
|
||||
EnvVar(name="SERPLY_API_KEY", description="API key for Serply services", required=True),
|
||||
]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import os
|
||||
from typing import Any, Optional, Type
|
||||
from typing import Any, List, Optional, Type
|
||||
from urllib.parse import urlencode
|
||||
|
||||
import requests
|
||||
from crewai.tools import BaseTool
|
||||
from crewai.tools import BaseTool, EnvVar
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ class SerplyNewsSearchTool(BaseTool):
|
||||
proxy_location: Optional[str] = "US"
|
||||
headers: Optional[dict] = {}
|
||||
limit: Optional[int] = 10
|
||||
env_vars: List[EnvVar] = [
|
||||
EnvVar(name="SERPLY_API_KEY", description="API key for Serply services", required=True),
|
||||
]
|
||||
|
||||
def __init__(
|
||||
self, limit: Optional[int] = 10, proxy_location: Optional[str] = "US", **kwargs
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import os
|
||||
from typing import Any, Optional, Type
|
||||
from typing import Any, List, Optional, Type
|
||||
from urllib.parse import urlencode
|
||||
|
||||
import requests
|
||||
from crewai.tools import BaseTool
|
||||
from crewai.tools import BaseTool, EnvVar
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ class SerplyScholarSearchTool(BaseTool):
|
||||
hl: Optional[str] = "us"
|
||||
proxy_location: Optional[str] = "US"
|
||||
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):
|
||||
"""
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import os
|
||||
from typing import Any, Optional, Type
|
||||
from typing import Any, List, Optional, Type
|
||||
|
||||
import requests
|
||||
from crewai.tools import EnvVar
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
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"
|
||||
proxy_location: Optional[str] = "US"
|
||||
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):
|
||||
"""
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import base64
|
||||
from pathlib import Path
|
||||
from typing import Optional, Type
|
||||
from typing import List, Optional, Type
|
||||
|
||||
from crewai import LLM
|
||||
from crewai.tools import BaseTool
|
||||
from crewai.tools import BaseTool, EnvVar
|
||||
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."
|
||||
)
|
||||
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")
|
||||
_llm: Optional[LLM] = PrivateAttr(default=None)
|
||||
|
||||
Reference in New Issue
Block a user