You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/develop/ai/langcache/api-examples.md
+9-211Lines changed: 9 additions & 211 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ curl -s -X POST "https://$HOST/v1/caches/$CACHE_ID/entries/search" \
35
35
-d "{ 'prompt': 'What is semantic caching' }"
36
36
{{< /clients-example >}}
37
37
38
-
- The example expects several variables to be set in the shell:
38
+
This example expects several variables to be set in the shell:
39
39
40
40
- **$HOST** - the LangCache API base URL
41
41
- **$CACHE_ID** - the Cache ID of your cache
@@ -74,75 +74,19 @@ POST https://[host]/v1/caches/{cacheId}/entries/search
74
74
75
75
Use [`POST /v1/caches/{cacheId}/entries`]({{< relref "/develop/ai/langcache/api-reference#tag/Cache-Entries/operation/set" >}}) to store a new response in the cache.
Use [`DELETE /v1/caches/{cacheId}/entries/{entryId}`]({{< relref "/develop/ai/langcache/api-reference#tag/Cache-Entries/operation/delete" >}}) to delete a cached response from the cache.
res = lang_cache.delete_by_id(entry_id="{entryId}")
231
-
232
-
print(res)
233
-
```
234
-
235
-
-tab-sep-
236
-
237
-
```js
238
-
import { LangCache } from"@redis-ai/langcache";
239
-
240
-
constlangCache=newLangCache({
241
-
serverURL:"https://<host>",
242
-
cacheId:"<cacheId>",
243
-
serviceKey:"<LANGCACHE_SERVICE_KEY>",
244
-
});
245
-
246
-
asyncfunctionrun() {
247
-
constresult=awaitlangCache.deleteById({
248
-
entryId:"<entryId>",
249
-
});
250
-
251
-
console.log(result);
252
-
}
253
-
254
-
run();
255
-
```
256
-
257
-
{{< /multitabs >}}
106
+
{{< /clients-example >}}
258
107
259
108
You can also use [`DELETE /v1/caches/{cacheId}/entries`]({{< relref "/develop/ai/langcache/api-reference#tag/Cache-Entries/operation/deleteQuery" >}}) to delete multiple cached responses based on the `attributes` you specify. If you specify multiple `attributes`, LangCache will delete entries that contain all given attributes.
260
109
@@ -264,63 +113,12 @@ If you do not specify any `attributes`, all responses in the cache will be delet
0 commit comments