@@ -9,7 +9,7 @@ type: integration
99
1010<a id =" semantic-cache-api " ></a >
1111
12- ### * class* SemanticCache(name='llmcache', distance_threshold=0.1, ttl=None, vectorizer=None, filterable_fields=None, redis_client=None, redis_url='redis://localhost:6379', connection_kwargs={}, overwrite=False, \*\ * kwargs)
12+ ### ` *class* SemanticCache(name='llmcache', distance_threshold=0.1, ttl=None, vectorizer=None, filterable_fields=None, redis_client=None, redis_url='redis://localhost:6379', connection_kwargs={}, overwrite=False, * *kwargs) `
1313
1414Bases: ` BaseLLMCache `
1515
@@ -41,7 +41,7 @@ Semantic Cache for Large Language Models.
4141 * ** ValueError** – If the threshold is not between 0 and 1.
4242 * ** ValueError** – If existing schema does not match new schema and overwrite is False.
4343
44- #### * async* acheck(prompt=None, vector=None, num_results=1, return_fields=None, filter_expression=None, distance_threshold=None)
44+ #### ` *async* acheck(prompt=None, vector=None, num_results=1, return_fields=None, filter_expression=None, distance_threshold=None) `
4545
4646Async check the semantic cache for results similar to the specified prompt
4747or vector.
@@ -82,7 +82,7 @@ response = await cache.acheck(
8282)
8383```
8484
85- #### * async* adrop(ids=None, keys=None)
85+ #### ` *async* adrop(ids=None, keys=None) `
8686
8787Async expire specific entries from the cache by id or specific
8888Redis key.
@@ -93,7 +93,7 @@ Redis key.
9393* ** Return type:**
9494 None
9595
96- #### * async* astore(prompt, response, vector=None, metadata=None, filters=None, ttl=None)
96+ #### ` *async* astore(prompt, response, vector=None, metadata=None, filters=None, ttl=None) `
9797
9898Async stores the specified key-value pair in the cache along with metadata.
9999
@@ -126,7 +126,7 @@ key = await cache.astore(
126126)
127127```
128128
129- #### * async* aupdate(key, \*\ * kwargs)
129+ #### ` *async* aupdate(key, * *kwargs) `
130130
131131Async update specific fields within an existing cache entry. If no fields
132132are passed, then only the document TTL is refreshed.
@@ -147,7 +147,7 @@ await cache.aupdate(
147147)
148148```
149149
150- #### check(prompt=None, vector=None, num_results=1, return_fields=None, filter_expression=None, distance_threshold=None)
150+ #### ` check(prompt=None, vector=None, num_results=1, return_fields=None, filter_expression=None, distance_threshold=None) `
151151
152152Checks the semantic cache for results similar to the specified prompt
153153or vector.
@@ -188,22 +188,22 @@ response = cache.check(
188188)
189189```
190190
191- #### clear()
191+ #### ` clear() `
192192
193193Clear the cache of all keys while preserving the index.
194194
195195* ** Return type:**
196196 None
197197
198- #### delete()
198+ #### ` delete() `
199199
200200Clear the semantic cache of all keys and remove the underlying search
201201index.
202202
203203* ** Return type:**
204204 None
205205
206- #### drop(ids=None, keys=None)
206+ #### ` drop(ids=None, keys=None) `
207207
208208Manually expire specific entries from the cache by id or specific
209209Redis key.
@@ -214,7 +214,7 @@ Redis key.
214214* ** Return type:**
215215 None
216216
217- #### set_threshold(distance_threshold)
217+ #### ` set_threshold(distance_threshold) `
218218
219219Sets the semantic distance threshold for the cache.
220220
@@ -226,7 +226,7 @@ Sets the semantic distance threshold for the cache.
226226* ** Return type:**
227227 None
228228
229- #### set_ttl(ttl=None)
229+ #### ` set_ttl(ttl=None) `
230230
231231Set the default TTL, in seconds, for entries in the cache.
232232
@@ -236,7 +236,7 @@ Set the default TTL, in seconds, for entries in the cache.
236236* ** Raises:**
237237 ** ValueError** – If the time-to-live value is not an integer.
238238
239- #### store(prompt, response, vector=None, metadata=None, filters=None, ttl=None)
239+ #### ` store(prompt, response, vector=None, metadata=None, filters=None, ttl=None) `
240240
241241Stores the specified key-value pair in the cache along with metadata.
242242
@@ -269,7 +269,7 @@ key = cache.store(
269269)
270270```
271271
272- #### update(key, \*\ * kwargs)
272+ #### ` update(key, * *kwargs) `
273273
274274Update specific fields within an existing cache entry. If no fields
275275are passed, then only the document TTL is refreshed.
@@ -288,7 +288,7 @@ cache.update(key, metadata={"hit_count": 1, "model_name": "Llama-2-7b"})
288288)
289289```
290290
291- #### * property* aindex * : [ AsyncSearchIndex] ({{< relref "searchindex/#asyncsearchindex" >}}) | None*
291+ #### ` *property* aindex *: [AsyncSearchIndex]({{< relref "searchindex/#asyncsearchindex" >}}) | None* `
292292
293293The underlying AsyncSearchIndex for the cache.
294294
@@ -297,7 +297,7 @@ The underlying AsyncSearchIndex for the cache.
297297* ** Return type:**
298298 [ AsyncSearchIndex] ({{< relref "searchindex/#asyncsearchindex" >}})
299299
300- #### * property* distance_threshold * : float*
300+ #### ` *property* distance_threshold *: float* `
301301
302302The semantic distance threshold for the cache.
303303
@@ -306,7 +306,7 @@ The semantic distance threshold for the cache.
306306* ** Return type:**
307307 float
308308
309- #### * property* index * : [ SearchIndex] ({{< relref "searchindex/#searchindex" >}})*
309+ #### ` *property* index *: [SearchIndex]({{< relref "searchindex/#searchindex" >}})* `
310310
311311The underlying SearchIndex for the cache.
312312
@@ -315,6 +315,6 @@ The underlying SearchIndex for the cache.
315315* ** Return type:**
316316 [ SearchIndex] ({{< relref "searchindex/#searchindex" >}})
317317
318- #### * property* ttl * : int | None*
318+ #### ` *property* ttl *: int | None* `
319319
320320The default TTL, in seconds, for entries in the cache.
0 commit comments