Skip to content

Error when calling LangCacheSemanticCache.clear() method #427

@justin-cechmanek

Description

@justin-cechmanek

An API error is raised when calling the clear() method.

A cloud db and service does exist.

Minimum reproducible example:

` from redisvl.extensions.cache.llm.langcache import LangCacheSemanticCache
import os

cache = LangCacheSemanticCache(
api_key=os.environ.get('LANGCACHE_API_KEY'),
cache_id=os.environ.get('LANGCACHE_ID')
)

cache.store(prompt='hello world', response='hello from langcache')

result = cache.check('hello world!')
print(result)

cache.clear()`

13:30:09 httpx INFO HTTP Request: POST https://aws-us-east-1.langcache.redis.io/v1/caches/56f7ba9bee374701a1253f21cd1ac35e/entries "HTTP/1.1 201 Created" 13:30:09 httpx INFO HTTP Request: POST https://aws-us-east-1.langcache.redis.io/v1/caches/56f7ba9bee374701a1253f21cd1ac35e/entries/search "HTTP/1.1 200 OK" [{'entry_id': '5eb63bbbe01eeed093cb22bb8f5acdc3', 'prompt': 'hello world', 'response': 'hello from langcache', 'vector_distance': 0.05443430000000005, 'inserted_at': 0.0, 'updated_at': 0.0}] 13:30:09 httpx INFO HTTP Request: DELETE https://aws-us-east-1.langcache.redis.io/v1/caches/56f7ba9bee374701a1253f21cd1ac35e/entries "HTTP/1.1 400 Bad Request" Traceback (most recent call last): File "/Users/justin.cechmanek/Documents/redis-ai-resources/test_langcache.py", line 15, in <module> cache.clear() File "/Users/justin.cechmanek/.pyenv/versions/redis-ai-res/lib/python3.11/site-packages/redisvl/extensions/cache/llm/langcache.py", line 557, in clear self.delete() File "/Users/justin.cechmanek/.pyenv/versions/redis-ai-res/lib/python3.11/site-packages/redisvl/extensions/cache/llm/langcache.py", line 542, in delete self._client.delete_query(attributes={}) File "/Users/justin.cechmanek/.pyenv/versions/redis-ai-res/lib/python3.11/site-packages/langcache/sdk.py", line 227, in delete_query raise errors.BadRequestErrorResponseContent(response_data, http_res) langcache.errors.badrequesterrorresponsecontent.BadRequestErrorResponseContent: {"detail":"attributes: cannot be blank.","status":400,"title":"Invalid Request","type":"/errors/invalid-data"}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions