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: if inputs is not None and "id" not in inputs:
self._initialize_state(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 @init_flow_main_trace
async def kickoff_async(self, inputs: Optional[Dict[str, Any]] = None) -> Any: 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.context_window_size = 0
self.reasoning_effort = reasoning_effort self.reasoning_effort = reasoning_effort
self.additional_params = kwargs self.additional_params = kwargs
self._message_history = [] self._message_history: List[Dict[str, str]] = []
self.is_anthropic = self._is_anthropic_model(model) self.is_anthropic = self._is_anthropic_model(model)
litellm.drop_params = True litellm.drop_params = True
@@ -575,7 +575,7 @@ class LLM:
return [] return []
if not hasattr(self, "_tool_results_history"): if not hasattr(self, "_tool_results_history"):
self._tool_results_history = [] self._tool_results_history: List[Dict] = []
new_tool_results = [] new_tool_results = []

View File

@@ -119,8 +119,8 @@ class ToolUsage:
if ( if (
isinstance(tool, CrewStructuredTool) isinstance(tool, CrewStructuredTool)
and tool.name == self._i18n.tools("add_image")["name"] and tool.name == self._i18n.tools("add_image")["name"] # type: ignore
): # type: ignore ):
try: try:
result = self._use(tool_string=tool_string, tool=tool, calling=calling) result = self._use(tool_string=tool_string, tool=tool, calling=calling)
return result 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). and recording of results for various types of operations (LLM calls, tool calls, flow steps).
""" """
_task_traces: Dict[str, List["UnifiedTraceController"]] = {}
def __init__( def __init__(
self, self,
trace_type: TraceType, trace_type: TraceType,
@@ -88,8 +90,6 @@ class UnifiedTraceController:
Returns: Returns:
List of traces associated with the task List of traces associated with the task
""" """
if not hasattr(cls, "_task_traces"):
cls._task_traces = {}
return cls._task_traces.get(task_id, []) return cls._task_traces.get(task_id, [])
@classmethod @classmethod