Skip to content

Commit 4dc2940

Browse files
authored
Merge pull request #1931 from redis/update-langcache-api-yaml
Update LangCache openapi spec
2 parents 5fca0a8 + 5173efd commit 4dc2940

File tree

1 file changed

+107
-5
lines changed
  • content/develop/ai/langcache/api-reference

1 file changed

+107
-5
lines changed

content/develop/ai/langcache/api-reference/api.yaml

Lines changed: 107 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ paths:
5353
'application/json':
5454
schema:
5555
$ref: '#/components/schemas/ForbiddenErrorResponseContent'
56+
'404':
57+
description: Cache not found
58+
content:
59+
'application/json':
60+
schema:
61+
$ref: '#/components/schemas/NotFoundErrorResponseContent'
62+
'424':
63+
description: Failed dependency
64+
content:
65+
'application/json':
66+
schema:
67+
$ref: '#/components/schemas/FailedDependencyErrorResponseContent'
5668
'500':
5769
description: An unexpected error occurred
5870
content:
@@ -105,6 +117,18 @@ paths:
105117
'application/json':
106118
schema:
107119
$ref: '#/components/schemas/ForbiddenErrorResponseContent'
120+
'404':
121+
description: Cache not found
122+
content:
123+
'application/json':
124+
schema:
125+
$ref: '#/components/schemas/NotFoundErrorResponseContent'
126+
'424':
127+
description: Failed dependency
128+
content:
129+
'application/json':
130+
schema:
131+
$ref: '#/components/schemas/FailedDependencyErrorResponseContent'
108132
'500':
109133
description: An unexpected error occurred
110134
content:
@@ -156,6 +180,18 @@ paths:
156180
'application/json':
157181
schema:
158182
$ref: '#/components/schemas/ForbiddenErrorResponseContent'
183+
'404':
184+
description: Cache not found
185+
content:
186+
'application/json':
187+
schema:
188+
$ref: '#/components/schemas/NotFoundErrorResponseContent'
189+
'424':
190+
description: Failed dependency
191+
content:
192+
'application/json':
193+
schema:
194+
$ref: '#/components/schemas/FailedDependencyErrorResponseContent'
159195
'500':
160196
description: An unexpected error occurred
161197
content:
@@ -200,11 +236,17 @@ paths:
200236
schema:
201237
$ref: '#/components/schemas/ForbiddenErrorResponseContent'
202238
'404':
203-
description: Cache entry not found
239+
description: Cache or cache entry not found
204240
content:
205241
'application/json':
206242
schema:
207243
$ref: '#/components/schemas/NotFoundErrorResponseContent'
244+
'424':
245+
description: Failed dependency
246+
content:
247+
'application/json':
248+
schema:
249+
$ref: '#/components/schemas/FailedDependencyErrorResponseContent'
208250
'500':
209251
description: An unexpected error occurred
210252
content:
@@ -226,13 +268,15 @@ components:
226268
required: true
227269
schema:
228270
type: string
271+
pattern: '^[a-zA-Z0-9]+$'
229272
entryId:
230273
name: entryId
231274
in: path
232275
description: The ID of the cache entry to delete.
233276
required: true
234277
schema:
235278
type: string
279+
pattern: '^[a-f0-9]{32}$'
236280
schemas:
237281
SearchEntriesRequest:
238282
required:
@@ -242,6 +286,8 @@ components:
242286
prompt:
243287
type: string
244288
description: The prompt to search for in the cache.
289+
minLength: 1
290+
maxLength: 1024
245291
example: How does semantic caching work?
246292
similarityThreshold:
247293
minimum: 0
@@ -252,8 +298,14 @@ components:
252298
example: 0.9
253299
attributes:
254300
type: object
301+
maxProperties: 5
302+
propertyNames:
303+
pattern: '^[a-zA-Z0-9_-]{1,32}$'
255304
additionalProperties:
256305
type: string
306+
minLength: 1
307+
maxLength: 500
308+
pattern: '^[^,]*$'
257309
description: Key-value pairs of attributes that filter the cache entries. If provided, this endpoint only returns entries that contain all given attributes.
258310
example:
259311
language: en
@@ -282,7 +334,8 @@ components:
282334
id:
283335
type: string
284336
description: Unique identifier for the cache entry.
285-
example: myIndex:5b84acef3ce360988d1b35adbaaaccb164569b6d79fab04fd888b5fea03fb8f2
337+
pattern: '^[a-f0-9]{32}$'
338+
example: 5b84acef3ce360988d1b35adbaaaccb1
286339
prompt:
287340
type: string
288341
description: The prompt associated with the cache entry.
@@ -293,8 +346,14 @@ components:
293346
example: Semantic caching stores and retrieves data based on meaning, not exact matches.
294347
attributes:
295348
type: object
349+
maxProperties: 5
350+
propertyNames:
351+
pattern: '^[a-zA-Z0-9_-]{1,32}$'
296352
additionalProperties:
297353
type: string
354+
minLength: 1
355+
maxLength: 500
356+
pattern: '^[^,]*$'
298357
description: The key-value pairs of attributes that are associated with the cache entry.
299358
example:
300359
language: en
@@ -303,6 +362,8 @@ components:
303362
type: number
304363
description: The similarity metric used for similarity comparison.
305364
format: float
365+
minimum: 0
366+
maximum: 1
306367
example: 0.95
307368
description: A cache entry
308369
SetEntryRequest:
@@ -315,22 +376,33 @@ components:
315376
example: How does semantic caching work?
316377
type: string
317378
description: The prompt for the entry.
379+
minLength: 1
380+
maxLength: 1024
318381
response:
319382
example: Semantic caching stores and retrieves data based on meaning, not exact matches.
320383
type: string
321384
description: The response to the prompt for the entry.
322385
attributes:
323386
type: object
387+
maxProperties: 5
388+
propertyNames:
389+
pattern: '^[a-zA-Z0-9_-]{1,32}$'
324390
additionalProperties:
325391
type: string
392+
minLength: 1
393+
maxLength: 500
394+
pattern: '^[^,]*$'
326395
description: Key-value pairs of attributes to be associated with the entry. These can be used for filtering when searching for entries. All attribute names that can be associated with an entry must be defined during cache creation.
327396
example:
328397
language: en
329398
topic: ai
330399
ttlMillis:
331400
type: integer
332-
description: The entry's time-to-live, in milliseconds.
401+
description: The entry's time-to-live, in milliseconds. If not set, the cache's default TTL is used.
333402
format: int64
403+
minimum: 1
404+
maximum: 31556952000
405+
example: 60000
334406
description: Request to add a cache entry to the cache
335407
SetEntryResponse:
336408
required:
@@ -340,6 +412,7 @@ components:
340412
entryId:
341413
type: string
342414
description: The ID of the entry that was added to the cache.
415+
pattern: '^[a-f0-9]{32}$'
343416
description: Response representing a successful cache entry addition
344417
DeleteEntriesRequest:
345418
required:
@@ -348,8 +421,14 @@ components:
348421
properties:
349422
attributes:
350423
type: object
424+
maxProperties: 5
425+
propertyNames:
426+
pattern: '^[a-zA-Z0-9_-]{1,32}$'
351427
additionalProperties:
352428
type: string
429+
minLength: 1
430+
maxLength: 500
431+
pattern: '^[^,]*$'
353432
description: Key-value pairs of attributes associated with the cache entries to delete. If provided, this endpoint only deletes entries that contain all given attributes. If not provided, this endpoint deletes all entries in the cache.
354433
example:
355434
language: en
@@ -437,6 +516,31 @@ components:
437516
type: string
438517
enum:
439518
- /errors/unauthorized
519+
FailedDependencyErrorResponseContent:
520+
type: object
521+
properties:
522+
title:
523+
type: string
524+
description: A short summary of the problem type.
525+
example: Failed Dependency
526+
status:
527+
type: integer
528+
default: 424
529+
description: The HTTP status code generated by the origin server.
530+
detail:
531+
type: string
532+
description: An explanation specific to this problem.
533+
type:
534+
$ref: '#/components/schemas/FailedDependencyErrorUri'
535+
required:
536+
- status
537+
- title
538+
- type
539+
FailedDependencyErrorUri:
540+
type: string
541+
enum:
542+
- /errors/embeddings/unauthorized
543+
- /errors/embeddings/too-many-requests
440544
ServiceUnavailableErrorResponseContent:
441545
type: object
442546
properties:
@@ -462,8 +566,6 @@ components:
462566
enum:
463567
- /errors/cache/unexpected-error
464568
- /errors/cache/authentication
465-
- /errors/embeddings/unauthorized
466-
- /errors/embeddings/too-many-requests
467569
- /errors/embeddings/unexpected-error
468570
NotFoundErrorResponseContent:
469571
type: object

0 commit comments

Comments
 (0)