Skip to content

Commit

Permalink
fix #171
Browse files Browse the repository at this point in the history
  • Loading branch information
slundberg committed Jun 2, 2023
1 parent cb4571a commit 58a22fc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion guidance/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.0.58"
__version__ = "0.0.59"

import types
import sys
Expand Down
3 changes: 3 additions & 0 deletions guidance/llms/caches/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 3 additions & 0 deletions guidance/llms/caches/_diskcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
5 changes: 5 additions & 0 deletions tests/llms/caches/test_diskcache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import guidance

def test_clear():
"""Makes sure we call clear"""
guidance.llms.OpenAI.cache.clear()
2 changes: 1 addition & 1 deletion tests/test_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 58a22fc

Please sign in to comment.