Skip to content

Commit 033a11e

Browse files
committed
Edited api.yaml for style and added option to not sort operations alphabetically
1 parent 24acd6a commit 033a11e

File tree

3 files changed

+50
-42
lines changed

3 files changed

+50
-42
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ layout: apireference
55
type: page
66
params:
77
sourcefile: ./api.yaml
8+
sortOperationsAlphabetically: false
89
---

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

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
openapi: 3.0.1
22
info:
33
title: Redis LangCache Service
4-
description: API for managing a Redis LangCache
4+
description: API for managing a [Redis LangCache](https://redis.io/docs/latest/develop/ai/langcache/) service.
55
contact:
66
name: Redis
77
88
version: '1.0'
99
tags:
1010
- name: Cache Entries
11-
description: Operations for creating, searching, and deleting cache entries
11+
description: Operations for creating, searching, and deleting cache entries.
1212
servers:
1313
- url: http://localhost:8080
1414
description: Generated server URL
@@ -18,6 +18,7 @@ paths:
1818
tags:
1919
- Cache Entries
2020
summary: Search the cache
21+
description: Searches the cache for entries that match the prompt and attributes. If no entries are found, this endpoint returns an empty array.
2122
operationId: search
2223
parameters:
2324
- $ref: '#/components/parameters/cacheId'
@@ -68,7 +69,8 @@ paths:
6869
post:
6970
tags:
7071
- Cache Entries
71-
summary: Add a new cache entry to the cache
72+
summary: Add a new entry to the cache
73+
description: Adds an entry to the cache with a prompt and response.
7274
operationId: set
7375
parameters:
7476
- $ref: '#/components/parameters/cacheId'
@@ -118,7 +120,8 @@ paths:
118120
delete:
119121
tags:
120122
- Cache Entries
121-
summary: Delete cache entries based on the request parameters
123+
summary: Delete multiple cache entries
124+
description: Deletes multiple cache entries based on specified attributes. If no attributes are provided, all entries in the cache are deleted.
122125
operationId: deleteQuery
123126
parameters:
124127
- $ref: '#/components/parameters/cacheId'
@@ -169,7 +172,8 @@ paths:
169172
delete:
170173
tags:
171174
- Cache Entries
172-
summary: Delete a cache entry by ID
175+
summary: Delete a single cache entry
176+
description: Deletes a single cache entry by the entry ID.
173177
operationId: delete
174178
parameters:
175179
- $ref: '#/components/parameters/cacheId'
@@ -218,14 +222,14 @@ components:
218222
cacheId:
219223
name: cacheId
220224
in: path
221-
description: The ID of the cache
225+
description: The cache ID.
222226
required: true
223227
schema:
224228
type: string
225229
entryId:
226230
name: entryId
227231
in: path
228-
description: The ID of the cache entry to delete
232+
description: The ID of the cache entry to delete.
229233
required: true
230234
schema:
231235
type: string
@@ -237,20 +241,20 @@ components:
237241
properties:
238242
prompt:
239243
type: string
240-
description: The prompt to search in the cache
244+
description: The prompt to search for in the cache.
241245
example: How does semantic caching work?
242246
similarityThreshold:
243247
minimum: 0
244248
maximum: 1
245249
type: number
246-
description: The minimum similarity threshold for the cache entry (normalized cosine similarity)
250+
description: The minimum similarity threshold for the cache entry (normalized cosine similarity).
247251
format: float
248252
example: 0.9
249253
attributes:
250254
type: object
251255
additionalProperties:
252256
type: string
253-
description: Key-value pairs of attributes based on which to filter the cache entries. If multiple attributes are provided, only entries matching all attributes can be returned.
257+
description: Key-value pairs of attributes that filter the cache entries. If provided, this endpoint only returns entries that contain all given attributes.
254258
example:
255259
language: en
256260
topic: ai
@@ -264,7 +268,7 @@ components:
264268
type: array
265269
items:
266270
$ref: '#/components/schemas/CacheEntry'
267-
description: Array of cache entries matching the search criteria
271+
description: Array of cache entries matching the search criteria. This array is empty if no entries match the search criteria.
268272
description: Response representing the result of a successful cache entries search operation
269273
CacheEntry:
270274
required:
@@ -277,27 +281,27 @@ components:
277281
properties:
278282
id:
279283
type: string
280-
description: Unique identifier for the cache entry
284+
description: Unique identifier for the cache entry.
281285
example: myIndex:5b84acef3ce360988d1b35adbaaaccb164569b6d79fab04fd888b5fea03fb8f2
282286
prompt:
283287
type: string
284-
description: The prompt associated with the cache entry
288+
description: The prompt associated with the cache entry.
285289
example: Tell me how semantic caching works
286290
response:
287291
type: string
288-
description: The response associated with the cache entry
292+
description: The response associated with the cache entry.
289293
example: Semantic caching stores and retrieves data based on meaning, not exact matches.
290294
attributes:
291295
type: object
292296
additionalProperties:
293297
type: string
294-
description: The key-value pairs of attributes that are associated with the cache entry
298+
description: The key-value pairs of attributes that are associated with the cache entry.
295299
example:
296300
language: en
297301
topic: ai
298302
similarity:
299303
type: number
300-
description: The similarity metric used for similarity comparison
304+
description: The similarity metric used for similarity comparison.
301305
format: float
302306
example: 0.95
303307
description: A cache entry
@@ -310,22 +314,22 @@ components:
310314
prompt:
311315
example: How does semantic caching work?
312316
type: string
313-
description: The entry's prompt
317+
description: The prompt for the entry.
314318
response:
315319
example: Semantic caching stores and retrieves data based on meaning, not exact matches.
316320
type: string
317-
description: The entry's response
321+
description: The response to the prompt for the entry.
318322
attributes:
319323
type: object
320324
additionalProperties:
321325
type: string
322-
description: Key-value pairs of attributes to be associated with the entry, can be used for filtering when searching for entries. All attribute names that can be associated with an entry must be initially defined during the cache creation.
326+
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.
323327
example:
324328
language: en
325329
topic: ai
326330
ttlMillis:
327331
type: integer
328-
description: The entry's time-to-live, in milliseconds
332+
description: The entry's time-to-live, in milliseconds.
329333
format: int64
330334
description: Request to add a cache entry to the cache
331335
SetEntryResponse:
@@ -335,7 +339,7 @@ components:
335339
properties:
336340
entryId:
337341
type: string
338-
description: The ID of the entry that was added to the cache
342+
description: The ID of the entry that was added to the cache.
339343
description: Response representing a successful cache entry addition
340344
DeleteEntriesRequest:
341345
required:
@@ -346,7 +350,7 @@ components:
346350
type: object
347351
additionalProperties:
348352
type: string
349-
description: Key-value pairs of attributes based on which to delete cache entries. If multiple attributes are provided, only entries matching all attributes will be deleted.
353+
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.
350354
example:
351355
language: en
352356
topic: ai
@@ -358,7 +362,7 @@ components:
358362
properties:
359363
deletedEntriesCount:
360364
type: integer
361-
description: The number of cache entries successfully deleted
365+
description: The number of cache entries successfully deleted.
362366
format: int64
363367
example: 42
364368
description: Response indicating the result of a cache entries deletion operation
@@ -367,15 +371,15 @@ components:
367371
properties:
368372
title:
369373
type: string
370-
description: A short, human-readable summary of the problem type
374+
description: A short summary of the problem type.
371375
example: Invalid Request
372376
status:
373377
type: integer
374378
default: 400
375-
description: The HTTP status code generated by the origin server for this occurrence of the problem
379+
description: The HTTP status code generated by the origin server.
376380
detail:
377381
type: string
378-
description: A human-readable explanation specific to this occurrence of the problem
382+
description: An explanation specific to this problem.
379383
type:
380384
$ref: '#/components/schemas/BadRequestErrorUri'
381385
required:
@@ -391,14 +395,14 @@ components:
391395
properties:
392396
title:
393397
type: string
394-
description: A short, human-readable summary of the problem type
398+
description: A short summary of the problem type.
395399
status:
396400
type: integer
397401
default: 401
398-
description: The HTTP status code generated by the origin server for this occurrence of the problem
402+
description: The HTTP status code generated by the origin server.
399403
detail:
400404
type: string
401-
description: A human-readable explanation specific to this occurrence of the problem
405+
description: An explanation specific to this problem.
402406
type:
403407
$ref: '#/components/schemas/AuthenticationErrorUri'
404408
required:
@@ -414,15 +418,15 @@ components:
414418
properties:
415419
title:
416420
type: string
417-
description: A short, human-readable summary of the problem type
421+
description: A short summary of the problem type.
418422
example: Unauthorized
419423
status:
420424
type: integer
421425
default: 403
422-
description: The HTTP status code generated by the origin server for this occurrence of the problem
426+
description: The HTTP status code generated by the origin server.
423427
detail:
424428
type: string
425-
description: A human-readable explanation specific to this occurrence of the problem
429+
description: An explanation specific to this problem.
426430
type:
427431
$ref: '#/components/schemas/ForbiddenErrorUri'
428432
required:
@@ -438,15 +442,15 @@ components:
438442
properties:
439443
title:
440444
type: string
441-
description: A short, human-readable summary of the problem type
445+
description: A short summary of the problem type.
442446
example: Service Unavailable
443447
status:
444448
type: integer
445449
default: 503
446-
description: The HTTP status code generated by the origin server for this occurrence of the problem
450+
description: The HTTP status code generated by the origin server.
447451
detail:
448452
type: string
449-
description: A human-readable explanation specific to this occurrence of the problem
453+
description: An explanation specific to this problem.
450454
type:
451455
$ref: '#/components/schemas/ServiceUnavailableErrorUri'
452456
required:
@@ -466,14 +470,14 @@ components:
466470
properties:
467471
title:
468472
type: string
469-
description: A short, human-readable summary of the problem type
473+
description: A short summary of the problem type.
470474
status:
471475
type: integer
472476
default: 404
473-
description: The HTTP status code generated by the origin server for this occurrence of the problem
477+
description: The HTTP status code generated by the origin server.
474478
detail:
475479
type: string
476-
description: A human-readable explanation specific to this occurrence of the problem
480+
description: An explanation specific to this problem.
477481
type:
478482
$ref: '#/components/schemas/NotFoundErrorUri'
479483
required:
@@ -489,14 +493,14 @@ components:
489493
properties:
490494
title:
491495
type: string
492-
description: A short, human-readable summary of the problem type
496+
description: A short summary of the problem type.
493497
status:
494498
type: integer
495499
default: 500
496-
description: The HTTP status code generated by the origin server for this occurrence of the problem
500+
description: The HTTP status code generated by the origin server.
497501
detail:
498502
type: string
499-
description: A human-readable explanation specific to this occurrence of the problem
503+
description: An explanation specific to this problem.
500504
type:
501505
$ref: '#/components/schemas/InternalServerErrorUri'
502506
required:

layouts/_default/apireference.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
When creating a new API reference page, you can specify these optional params in the front matter:
77
- sourcefile: The path to the OpenAPI specification file (YAML or JSON) relative to the page. Default: ./openapi.json
88
- backLink: The path to the page to link to in the top left corner. Default: Parent page
9+
- sortOperationsAlphabetically: Whether to sort the operations alphabetically or use the order defined in the OpenAPI spec. Default: true
910
1011
Here's what the file structure should look like to use this template:
1112
<containing-folder>/
@@ -25,6 +26,7 @@
2526
params:
2627
sourcefile: ./<spec-file-name> (optional - only specify if not using ./openapi.json)
2728
backLink: <path-to-page> (optional - only specify if not using the parent page)
29+
sortOperationsAlphabetically: <true|false> (optional - default: true)
2830
---
2931
3032
Example usage for the Redis Cloud API with all params set:
@@ -36,6 +38,7 @@
3638
params:
3739
sourcefile: ./openapi.json
3840
backLink: operate/rc/api
41+
sortOperationsAlphabetically: true
3942
---
4043
-->
4144

@@ -106,7 +109,7 @@
106109
spec-url='{{ .Params.sourcefile | default "./openapi.json" }}'
107110
scroll-y-offset='#apiReferenceHeader'
108111
json-sample-expand-level=all
109-
sort-operations-alphabetically="true"
112+
sort-operations-alphabetically='{{ .Params.sortOperationsAlphabetically | default "true" }}'
110113
theme='{
111114
"rightPanel": {
112115
"width": "50%"

0 commit comments

Comments
 (0)