mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 15:18:29 +00:00
17 lines
356 B
Python
17 lines
356 B
Python
from typing import Optional
|
|
|
|
|
|
class CacheHandler:
|
|
"""Callback handler for tool usage."""
|
|
|
|
_cache: dict = {}
|
|
|
|
def __init__(self):
|
|
self._cache = {}
|
|
|
|
def add(self, tool, input, output):
|
|
self._cache[f"{tool}-{input}"] = output
|
|
|
|
def read(self, tool, input) -> Optional[str]:
|
|
return self._cache.get(f"{tool}-{input}")
|