feat: fix type checking issues

This commit is contained in:
Eduardo Chiarotti
2025-02-10 11:04:12 -03:00
parent 16722925eb
commit c20020e3fb
4 changed files with 10 additions and 7 deletions

View File

@@ -752,7 +752,10 @@ class Flow(Generic[T], metaclass=FlowMeta):
if inputs is not None and "id" not in inputs:
self._initialize_state(inputs)
return asyncio.run(self.kickoff_async())
async def run_flow():
return await self.kickoff_async()
return asyncio.run(run_flow())
@init_flow_main_trace
async def kickoff_async(self, inputs: Optional[Dict[str, Any]] = None) -> Any:

View File

@@ -189,7 +189,7 @@ class LLM:
self.context_window_size = 0
self.reasoning_effort = reasoning_effort
self.additional_params = kwargs
self._message_history = []
self._message_history: List[Dict[str, str]] = []
self.is_anthropic = self._is_anthropic_model(model)
litellm.drop_params = True
@@ -575,7 +575,7 @@ class LLM:
return []
if not hasattr(self, "_tool_results_history"):
self._tool_results_history = []
self._tool_results_history: List[Dict] = []
new_tool_results = []

View File

@@ -119,8 +119,8 @@ class ToolUsage:
if (
isinstance(tool, CrewStructuredTool)
and tool.name == self._i18n.tools("add_image")["name"]
): # type: ignore
and tool.name == self._i18n.tools("add_image")["name"] # type: ignore
):
try:
result = self._use(tool_string=tool_string, tool=tool, calling=calling)
return result

View File

@@ -23,6 +23,8 @@ class UnifiedTraceController:
and recording of results for various types of operations (LLM calls, tool calls, flow steps).
"""
_task_traces: Dict[str, List["UnifiedTraceController"]] = {}
def __init__(
self,
trace_type: TraceType,
@@ -88,8 +90,6 @@ class UnifiedTraceController:
Returns:
List of traces associated with the task
"""
if not hasattr(cls, "_task_traces"):
cls._task_traces = {}
return cls._task_traces.get(task_id, [])
@classmethod