fix: mypy errors in streaming.py and core.py

This commit is contained in:
Greyson LaLonde
2026-04-03 19:32:29 +08:00
parent caaccd748d
commit 2e1525f69a
2 changed files with 4 additions and 4 deletions

View File

@@ -1013,7 +1013,7 @@ class Agent(BaseAgent):
task=task, task=task,
i18n=self.i18n, i18n=self.i18n,
agent=self, agent=self,
crew=self.crew, # type: ignore[arg-type] crew=self.crew,
tools=parsed_tools, tools=parsed_tools,
prompt=prompt, prompt=prompt,
original_tools=raw_tools, original_tools=raw_tools,
@@ -1075,7 +1075,7 @@ class Agent(BaseAgent):
self.agent_executor.tools_handler = self.tools_handler self.agent_executor.tools_handler = self.tools_handler
self.agent_executor.request_within_rpm_limit = rpm_limit_fn self.agent_executor.request_within_rpm_limit = rpm_limit_fn
if self.agent_executor.llm: if isinstance(self.agent_executor.llm, BaseLLM):
existing_stop = getattr(self.agent_executor.llm, "stop", []) existing_stop = getattr(self.agent_executor.llm, "stop", [])
self.agent_executor.llm.stop = list( self.agent_executor.llm.stop = list(
set( set(

View File

@@ -142,8 +142,8 @@ def _unregister_handler(handler: Callable[[Any, BaseEvent], None]) -> None:
handler: The handler function to unregister. handler: The handler function to unregister.
""" """
with crewai_event_bus._rwlock.w_locked(): with crewai_event_bus._rwlock.w_locked():
handlers: frozenset[Callable[[Any, BaseEvent], None]] = ( handlers: frozenset[Callable[..., None]] = crewai_event_bus._sync_handlers.get(
crewai_event_bus._sync_handlers.get(LLMStreamChunkEvent, frozenset()) LLMStreamChunkEvent, frozenset()
) )
crewai_event_bus._sync_handlers[LLMStreamChunkEvent] = handlers - {handler} crewai_event_bus._sync_handlers[LLMStreamChunkEvent] = handlers - {handler}