diff --git a/guidance/__init__.py b/guidance/__init__.py index a79d1ad9f..68ac99758 100644 --- a/guidance/__init__.py +++ b/guidance/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.58" +__version__ = "0.0.59" import types import sys diff --git a/guidance/llms/caches/_cache.py b/guidance/llms/caches/_cache.py index 3eff6d2ed..297a67f54 100644 --- a/guidance/llms/caches/_cache.py +++ b/guidance/llms/caches/_cache.py @@ -35,3 +35,6 @@ def create_key(self, llm: str, **kwargs: Dict[str, Any]) -> str: hasher.update(combined) return hasher.hexdigest() + + def clear(self): + raise NotImplementedError() diff --git a/guidance/llms/caches/_diskcache.py b/guidance/llms/caches/_diskcache.py index f805d5b38..c7bc9443d 100644 --- a/guidance/llms/caches/_diskcache.py +++ b/guidance/llms/caches/_diskcache.py @@ -23,3 +23,6 @@ def __setitem__(self, key: str, value: str) -> None: def __contains__(self, key: str) -> bool: return key in self._diskcache + + def clear(self): + self._diskcache.clear() diff --git a/tests/llms/caches/test_diskcache.py b/tests/llms/caches/test_diskcache.py new file mode 100644 index 000000000..e7db041c5 --- /dev/null +++ b/tests/llms/caches/test_diskcache.py @@ -0,0 +1,5 @@ +import guidance + +def test_clear(): + """Makes sure we call clear""" + guidance.llms.OpenAI.cache.clear() \ No newline at end of file diff --git a/tests/test_program.py b/tests/test_program.py index e43008cac..0e9b34621 100644 --- a/tests/test_program.py +++ b/tests/test_program.py @@ -54,7 +54,7 @@ async def f(): loop.run_until_complete(f()) def test_agents(): - """Test agentes, calling prompt twice""" + """Test agents, calling prompt twice""" guidance.llm = get_llm("openai:gpt-3.5-turbo")