mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
feat: add mypy as type checker, update code and add comment to reference (#591)
* fix: fix test actually running * fix: fix test to not send request to openai * fix: fix linting to remove cli files * fix: exclude only files that breaks black * fix: Fix all Ruff checkings on the code and Fix Test with repeated name * fix: Change linter name on yml file * feat: update pre-commit * feat: remove need for isort on the code * feat: add mypy as type checker, update code and add comment to reference * feat: remove black linter * feat: remove poetry to run the command * feat: change logic to test mypy * feat: update tests yml to try to fix the tests gh action * feat: try to add just mypy to run on gh action * feat: fix yml file * feat: add comment to avoid issue on gh action * feat: decouple pytest from the necessity of poetry install * feat: change tests.yml to test different approach * feat: change to poetry run * fix: parameter field on yml file * fix: update parameters to be on the pyproject * fix: update pyproject to remove import untyped errors
This commit is contained in:
committed by
GitHub
parent
8430c2f9af
commit
1ec4da6947
@@ -8,13 +8,13 @@ from .cache.cache_handler import CacheHandler
|
||||
class ToolsHandler:
|
||||
"""Callback handler for tool usage."""
|
||||
|
||||
last_used_tool: ToolCalling = {}
|
||||
cache: CacheHandler
|
||||
last_used_tool: ToolCalling = {} # type: ignore # BUG?: Incompatible types in assignment (expression has type "Dict[...]", variable has type "ToolCalling")
|
||||
cache: Optional[CacheHandler]
|
||||
|
||||
def __init__(self, cache: Optional[CacheHandler] = None):
|
||||
"""Initialize the callback handler."""
|
||||
self.cache = cache
|
||||
self.last_used_tool = {}
|
||||
self.last_used_tool = {} # type: ignore # BUG?: same as above
|
||||
|
||||
def on_tool_use(
|
||||
self,
|
||||
@@ -23,7 +23,7 @@ class ToolsHandler:
|
||||
should_cache: bool = True,
|
||||
) -> Any:
|
||||
"""Run when tool ends running."""
|
||||
self.last_used_tool = calling
|
||||
self.last_used_tool = calling # type: ignore # BUG?: Incompatible types in assignment (expression has type "Union[ToolCalling, InstructorToolCalling]", variable has type "ToolCalling")
|
||||
if self.cache and should_cache and calling.tool_name != CacheTools().name:
|
||||
self.cache.add(
|
||||
tool=calling.tool_name,
|
||||
|
||||
Reference in New Issue
Block a user