Move to src dir usage (#99)

This commit is contained in:
Greyson LaLonde
2024-01-10 09:39:36 -05:00
committed by GitHub
parent a944cfc8d0
commit 155368be3b
22 changed files with 17 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
from typing import Optional
from pydantic import PrivateAttr
class CacheHandler:
"""Callback handler for tool usage."""
_cache: PrivateAttr = {}
def __init__(self):
self._cache = {}
def add(self, tool, input, output):
input = input.strip()
self._cache[f"{tool}-{input}"] = output
def read(self, tool, input) -> Optional[str]:
input = input.strip()
return self._cache.get(f"{tool}-{input}")