mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 00:02:36 +00:00
fix: resolve additional mypy type errors
- Fix tool_usage.py: proper type annotations for result and fingerprint metadata - Fix lite_agent.py: proper Union type for guardrail callable accepting both LiteAgentOutput and TaskOutput - Add missing return type annotations to task_output_storage_handler.py methods - Fix crew.py: replace Json generic check with str, remove unused type:ignore and redundant cast
This commit is contained in:
@@ -5,6 +5,7 @@ from collections.abc import Callable
|
||||
from typing import (
|
||||
Any,
|
||||
Optional,
|
||||
Union,
|
||||
cast,
|
||||
get_args,
|
||||
get_origin,
|
||||
@@ -39,6 +40,7 @@ from crewai.events.types.logging_events import AgentLogsExecutionEvent
|
||||
from crewai.flow.flow_trackable import FlowTrackable
|
||||
from crewai.llm import LLM
|
||||
from crewai.llms.base_llm import BaseLLM
|
||||
from crewai.task import TaskOutput
|
||||
from crewai.tools.base_tool import BaseTool
|
||||
from crewai.tools.structured_tool import CrewStructuredTool
|
||||
from crewai.utilities import I18N
|
||||
@@ -185,8 +187,8 @@ class LiteAgent(FlowTrackable, BaseModel):
|
||||
_messages: list[dict[str, str]] = PrivateAttr(default_factory=list)
|
||||
_iterations: int = PrivateAttr(default=0)
|
||||
_printer: Printer = PrivateAttr(default_factory=Printer)
|
||||
_guardrail: Optional[Callable[[LiteAgentOutput], tuple[bool, Any]]] = PrivateAttr(
|
||||
default=None
|
||||
_guardrail: Optional[Callable[[LiteAgentOutput | TaskOutput], tuple[bool, Any]]] = (
|
||||
PrivateAttr(default=None)
|
||||
)
|
||||
_guardrail_retry_count: int = PrivateAttr(default=0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user