mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
fix(files): make FileInput available at runtime for Pydantic models
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
import inspect
|
import inspect
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import logging
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import threading
|
import threading
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
|
||||||
Any,
|
Any,
|
||||||
ClassVar,
|
ClassVar,
|
||||||
cast,
|
cast,
|
||||||
@@ -31,10 +30,6 @@ from pydantic import (
|
|||||||
from pydantic_core import PydanticCustomError
|
from pydantic_core import PydanticCustomError
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from crewai_files import FileInput
|
|
||||||
|
|
||||||
from crewai.agents.agent_builder.base_agent import BaseAgent
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
from crewai.events.event_bus import crewai_event_bus
|
from crewai.events.event_bus import crewai_event_bus
|
||||||
from crewai.events.types.task_events import (
|
from crewai.events.types.task_events import (
|
||||||
@@ -57,10 +52,11 @@ from crewai.utilities.file_store import (
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from crewai_files import FilePath
|
from crewai_files import FileInput, FilePath
|
||||||
|
|
||||||
HAS_CREWAI_FILES = True
|
HAS_CREWAI_FILES = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
FileInput = Any # type: ignore[misc,assignment]
|
||||||
HAS_CREWAI_FILES = False
|
HAS_CREWAI_FILES = False
|
||||||
from crewai.utilities.guardrail import (
|
from crewai.utilities.guardrail import (
|
||||||
process_guardrail,
|
process_guardrail,
|
||||||
|
|||||||
Reference in New Issue
Block a user