mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 07:42:40 +00:00
fix: change ref, lint
This commit is contained in:
@@ -7,16 +7,18 @@ repos:
|
|||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
files: ^lib/crewai/src/
|
files: ^lib/crewai/src/
|
||||||
|
exclude: ^lib/crewai/
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
name: ruff-format
|
name: ruff-format
|
||||||
entry: uv run ruff format
|
entry: uv run ruff format
|
||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
files: ^lib/crewai/src/
|
files: ^lib/crewai/src/
|
||||||
|
exclude: ^lib/crewai/
|
||||||
- id: mypy
|
- id: mypy
|
||||||
name: mypy
|
name: mypy
|
||||||
entry: uv run mypy
|
entry: uv run mypy
|
||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
files: ^lib/crewai/src/
|
files: ^lib/crewai/src/
|
||||||
exclude: ^lib/crewai/tests/
|
exclude: ^lib/crewai/
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from crewai import Agent, Crew, Process, Task
|
from crewai import Agent, Crew, Process, Task
|
||||||
from crewai.project import CrewBase, agent, crew, task
|
|
||||||
from crewai.agents.agent_builder.base_agent import BaseAgent
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
from typing import List
|
from crewai.project import CrewBase, agent, crew, task
|
||||||
|
|
||||||
# If you want to run a snippet of code before or after the crew starts,
|
# If you want to run a snippet of code before or after the crew starts,
|
||||||
# you can use the @before_kickoff and @after_kickoff decorators
|
# you can use the @before_kickoff and @after_kickoff decorators
|
||||||
@@ -12,8 +11,8 @@ from typing import List
|
|||||||
class PoemCrew:
|
class PoemCrew:
|
||||||
"""Poem Crew"""
|
"""Poem Crew"""
|
||||||
|
|
||||||
agents: List[BaseAgent]
|
agents: list[BaseAgent]
|
||||||
tasks: List[Task]
|
tasks: list[Task]
|
||||||
|
|
||||||
# Learn more about YAML configuration files here:
|
# Learn more about YAML configuration files here:
|
||||||
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
|
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from typing import Type
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from crewai.tools import BaseTool
|
from crewai.tools import BaseTool
|
||||||
from pydantic import BaseModel, Field
|
|
||||||
|
|
||||||
|
|
||||||
class MyCustomToolInput(BaseModel):
|
class MyCustomToolInput(BaseModel):
|
||||||
@@ -12,10 +11,8 @@ class MyCustomToolInput(BaseModel):
|
|||||||
|
|
||||||
class MyCustomTool(BaseTool):
|
class MyCustomTool(BaseTool):
|
||||||
name: str = "Name of my tool"
|
name: str = "Name of my tool"
|
||||||
description: str = (
|
description: str = "Clear description for what this tool is useful for, your agent will need this information to use it."
|
||||||
"Clear description for what this tool is useful for, your agent will need this information to use it."
|
args_schema: type[BaseModel] = MyCustomToolInput
|
||||||
)
|
|
||||||
args_schema: Type[BaseModel] = MyCustomToolInput
|
|
||||||
|
|
||||||
def _run(self, argument: str) -> str:
|
def _run(self, argument: str) -> str:
|
||||||
# Implementation goes here
|
# Implementation goes here
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
import os
|
|
||||||
import contextvars
|
import contextvars
|
||||||
from typing import Optional
|
import os
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
_platform_integration_token: contextvars.ContextVar[Optional[str]] = contextvars.ContextVar(
|
_platform_integration_token: contextvars.ContextVar[str | None] = (
|
||||||
"platform_integration_token", default=None
|
contextvars.ContextVar("platform_integration_token", default=None)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def set_platform_integration_token(integration_token: str) -> None:
|
def set_platform_integration_token(integration_token: str) -> None:
|
||||||
_platform_integration_token.set(integration_token)
|
_platform_integration_token.set(integration_token)
|
||||||
|
|
||||||
def get_platform_integration_token() -> Optional[str]:
|
|
||||||
|
def get_platform_integration_token() -> str | None:
|
||||||
token = _platform_integration_token.get()
|
token = _platform_integration_token.get()
|
||||||
if token is None:
|
if token is None:
|
||||||
token = os.getenv("CREWAI_PLATFORM_INTEGRATION_TOKEN")
|
token = os.getenv("CREWAI_PLATFORM_INTEGRATION_TOKEN")
|
||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def platform_context(integration_token: str):
|
def platform_context(integration_token: str):
|
||||||
token = _platform_integration_token.set(integration_token)
|
token = _platform_integration_token.set(integration_token)
|
||||||
|
|||||||
@@ -14,16 +14,16 @@ from .annotations import (
|
|||||||
from .crew_base import CrewBase
|
from .crew_base import CrewBase
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
"CrewBase",
|
||||||
|
"after_kickoff",
|
||||||
"agent",
|
"agent",
|
||||||
|
"before_kickoff",
|
||||||
|
"cache_handler",
|
||||||
|
"callback",
|
||||||
"crew",
|
"crew",
|
||||||
"task",
|
"llm",
|
||||||
"output_json",
|
"output_json",
|
||||||
"output_pydantic",
|
"output_pydantic",
|
||||||
|
"task",
|
||||||
"tool",
|
"tool",
|
||||||
"callback",
|
|
||||||
"CrewBase",
|
|
||||||
"llm",
|
|
||||||
"cache_handler",
|
|
||||||
"before_kickoff",
|
|
||||||
"after_kickoff",
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
from collections.abc import Callable
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Callable
|
|
||||||
|
|
||||||
from crewai import Crew
|
from crewai import Crew
|
||||||
from crewai.project.utils import memoize
|
from crewai.project.utils import memoize
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ from crewai.rag.core.base_client import (
|
|||||||
BaseCollectionParams,
|
BaseCollectionParams,
|
||||||
)
|
)
|
||||||
from crewai.rag.types import SearchResult
|
from crewai.rag.types import SearchResult
|
||||||
from crewai.core.utilities.logger_utils import suppress_logging
|
from crewai.utilities.logger_utils import suppress_logging
|
||||||
|
|
||||||
|
|
||||||
class ChromaDBClient(BaseClient):
|
class ChromaDBClient(BaseClient):
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import re
|
import re
|
||||||
from typing import Final
|
from typing import Final
|
||||||
|
|
||||||
from crewai.core.utilities.paths import db_storage_path
|
from crewai.utilities.paths import db_storage_path
|
||||||
|
|
||||||
DEFAULT_TENANT: Final[str] = "default_tenant"
|
DEFAULT_TENANT: Final[str] = "default_tenant"
|
||||||
DEFAULT_DATABASE: Final[str] = "default_database"
|
DEFAULT_DATABASE: Final[str] = "default_database"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from crewai.rag.config.constants import (
|
|||||||
from crewai.rag.config.types import RagConfigType
|
from crewai.rag.config.types import RagConfigType
|
||||||
from crewai.rag.core.base_client import BaseClient
|
from crewai.rag.core.base_client import BaseClient
|
||||||
from crewai.rag.factory import create_client
|
from crewai.rag.factory import create_client
|
||||||
from crewai.core.utilities.import_utils import require
|
from crewai.utilities.import_utils import require
|
||||||
|
|
||||||
|
|
||||||
class RagContext(BaseModel):
|
class RagContext(BaseModel):
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from typing_extensions import deprecated
|
|||||||
|
|
||||||
from crewai.rag.core.base_embeddings_callable import EmbeddingFunction
|
from crewai.rag.core.base_embeddings_callable import EmbeddingFunction
|
||||||
from crewai.rag.core.base_embeddings_provider import BaseEmbeddingsProvider
|
from crewai.rag.core.base_embeddings_provider import BaseEmbeddingsProvider
|
||||||
from crewai.core.utilities.import_utils import import_and_validate_definition
|
from crewai.utilities.import_utils import import_and_validate_definition
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from chromadb.utils.embedding_functions.amazon_bedrock_embedding_function import (
|
from chromadb.utils.embedding_functions.amazon_bedrock_embedding_function import (
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from crewai.rag.config.optional_imports.protocols import (
|
|||||||
)
|
)
|
||||||
from crewai.rag.config.types import RagConfigType
|
from crewai.rag.config.types import RagConfigType
|
||||||
from crewai.rag.core.base_client import BaseClient
|
from crewai.rag.core.base_client import BaseClient
|
||||||
from crewai.core.utilities.import_utils import require
|
from crewai.utilities.import_utils import require
|
||||||
|
|
||||||
|
|
||||||
def create_client(config: RagConfigType) -> BaseClient:
|
def create_client(config: RagConfigType) -> BaseClient:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from typing import Final
|
|||||||
|
|
||||||
from qdrant_client.models import Distance, VectorParams
|
from qdrant_client.models import Distance, VectorParams
|
||||||
|
|
||||||
from crewai.core.utilities.paths import db_storage_path
|
from crewai.utilities.paths import db_storage_path
|
||||||
|
|
||||||
DEFAULT_VECTOR_PARAMS: Final = VectorParams(size=384, distance=Distance.COSINE)
|
DEFAULT_VECTOR_PARAMS: Final = VectorParams(size=384, distance=Distance.COSINE)
|
||||||
DEFAULT_EMBEDDING_MODEL: Final[str] = "sentence-transformers/all-MiniLM-L6-v2"
|
DEFAULT_EMBEDDING_MODEL: Final[str] = "sentence-transformers/all-MiniLM-L6-v2"
|
||||||
|
|||||||
Reference in New Issue
Block a user