mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-28 10:09:21 +00:00
feat(tools): declare env_vars on DatabricksQueryTool
Add EnvVar import and env_vars field to DatabricksQueryTool so the host UI knows which environment variables the tool requires. Both auth paths (DATABRICKS_HOST+TOKEN or DATABRICKS_CONFIG_PROFILE) are marked required=False with descriptions explaining the alternative.
This commit is contained in:
@@ -4,7 +4,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
from typing import TYPE_CHECKING, Any, TypeGuard, TypedDict
|
from typing import TYPE_CHECKING, Any, TypeGuard, TypedDict
|
||||||
|
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool, EnvVar
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, model_validator
|
||||||
|
|
||||||
|
|
||||||
@@ -99,6 +99,25 @@ class DatabricksQueryTool(BaseTool):
|
|||||||
|
|
||||||
_workspace_client: WorkspaceClient | None = None
|
_workspace_client: WorkspaceClient | None = None
|
||||||
package_dependencies: list[str] = Field(default_factory=lambda: ["databricks-sdk"])
|
package_dependencies: list[str] = Field(default_factory=lambda: ["databricks-sdk"])
|
||||||
|
env_vars: list[EnvVar] = Field(
|
||||||
|
default_factory=lambda: [
|
||||||
|
EnvVar(
|
||||||
|
name="DATABRICKS_HOST",
|
||||||
|
description="Databricks workspace URL (use with DATABRICKS_TOKEN, or set DATABRICKS_CONFIG_PROFILE instead).",
|
||||||
|
required=False,
|
||||||
|
),
|
||||||
|
EnvVar(
|
||||||
|
name="DATABRICKS_TOKEN",
|
||||||
|
description="Databricks personal access token (pair with DATABRICKS_HOST).",
|
||||||
|
required=False,
|
||||||
|
),
|
||||||
|
EnvVar(
|
||||||
|
name="DATABRICKS_CONFIG_PROFILE",
|
||||||
|
description="Databricks CLI profile name (alternative to DATABRICKS_HOST/TOKEN).",
|
||||||
|
required=False,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user