Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add async support to semantic cache extension #214

Merged
merged 6 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions redisvl/extensions/llmcache/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def set_ttl(self, ttl: Optional[int] = None):
self._ttl = None

def clear(self) -> None:
"""Clear the LLMCache of all keys in the index."""
"""Clear the cache of all keys in the index."""
raise NotImplementedError

async def aclear(self) -> None:
"""Async clear the cache of all keys in the index."""
raise NotImplementedError

def check(
Expand All @@ -41,6 +45,17 @@ def check(
num_results: int = 1,
return_fields: Optional[List[str]] = None,
) -> List[dict]:
"""Check the cache based on a prompt or vector."""
raise NotImplementedError

async def acheck(
self,
prompt: Optional[str] = None,
vector: Optional[List[float]] = None,
num_results: int = 1,
return_fields: Optional[List[str]] = None,
) -> List[dict]:
"""Async check the cache based on a prompt or vector."""
raise NotImplementedError

def store(
Expand All @@ -50,7 +65,18 @@ def store(
vector: Optional[List[float]] = None,
metadata: Optional[dict] = {},
) -> str:
"""Stores the specified key-value pair in the cache along with
"""Store the specified key-value pair in the cache along with
metadata."""
raise NotImplementedError

async def astore(
self,
prompt: str,
response: str,
vector: Optional[List[float]] = None,
metadata: Optional[dict] = {},
) -> str:
"""Async store the specified key-value pair in the cache along with
metadata."""
raise NotImplementedError

Expand Down
Loading
Loading