@llmops/gateway 0.3.1 → 0.3.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -10375,7 +10375,7 @@ const retryRequest = async (url, options, retryCount, statusCodesToRetry, timeou
10375
10375
 
10376
10376
  //#endregion
10377
10377
  //#region package.json
10378
- var version = "0.3.1";
10378
+ var version = "0.3.2-beta.2";
10379
10379
 
10380
10380
  //#endregion
10381
10381
  //#region src/providers/bytez/api.ts
package/dist/index.mjs CHANGED
@@ -10348,7 +10348,7 @@ const retryRequest = async (url, options, retryCount, statusCodesToRetry, timeou
10348
10348
 
10349
10349
  //#endregion
10350
10350
  //#region package.json
10351
- var version = "0.3.1";
10351
+ var version = "0.3.2-beta.2";
10352
10352
 
10353
10353
  //#endregion
10354
10354
  //#region src/providers/bytez/api.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/gateway",
3
- "version": "0.3.1",
3
+ "version": "0.3.2-beta.2",
4
4
  "description": "AI gateway for LLMOps (forked from Portkey)",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -21,7 +21,8 @@
21
21
  "OpenAI"
22
22
  ],
23
23
  "files": [
24
- "dist"
24
+ "dist",
25
+ "plugins/default/manifest.json"
25
26
  ],
26
27
  "main": "./dist/index.cjs",
27
28
  "module": "./dist/index.mjs",
@@ -37,6 +38,7 @@
37
38
  "default": "./dist/index.cjs"
38
39
  }
39
40
  },
41
+ "./plugins/default/manifest.json": "./plugins/default/manifest.json",
40
42
  "./package.json": "./package.json"
41
43
  },
42
44
  "publishConfig": {
@@ -0,0 +1,998 @@
1
+ {
2
+ "id": "default",
3
+ "name": "Default",
4
+ "description": "The default set of guardrail functions available in the AI Gateway.",
5
+ "credentials": [],
6
+ "functions": [
7
+ {
8
+ "name": "Regex Match",
9
+ "id": "regexMatch",
10
+ "type": "guardrail",
11
+ "supportedHooks": ["beforeRequestHook", "afterRequestHook"],
12
+ "description": [
13
+ {
14
+ "type": "subHeading",
15
+ "text": "Check if the request or response text matches a regex pattern."
16
+ }
17
+ ],
18
+ "parameters": {
19
+ "type": "object",
20
+ "properties": {
21
+ "rule": {
22
+ "type": "string",
23
+ "label": "Regex Rule",
24
+ "description": [
25
+ {
26
+ "type": "subHeading",
27
+ "text": "Enter the regex pattern"
28
+ }
29
+ ]
30
+ },
31
+ "not": {
32
+ "type": "boolean",
33
+ "label": "Invert Match",
34
+ "description": [
35
+ {
36
+ "type": "subHeading",
37
+ "text": "If true, the verdict will be inverted"
38
+ }
39
+ ],
40
+ "default": false
41
+ }
42
+ },
43
+ "required": ["rule"]
44
+ }
45
+ },
46
+ {
47
+ "name": "Allowed Request Types",
48
+ "id": "allowedRequestTypes",
49
+ "type": "guardrail",
50
+ "supportedHooks": ["beforeRequestHook"],
51
+ "description": [
52
+ {
53
+ "type": "subHeading",
54
+ "text": "Control which request types (endpoints) can be processed. Use either an allowlist or blocklist approach. If no types are specified, all request types are allowed."
55
+ }
56
+ ],
57
+ "parameters": {
58
+ "type": "object",
59
+ "properties": {
60
+ "allowedTypes": {
61
+ "type": "array",
62
+ "label": "Allowed Request Types (Multi-select)",
63
+ "description": [
64
+ {
65
+ "type": "subHeading",
66
+ "text": "Select request types to allow. Can be combined with blockedTypes for refined control. Can also be specified in metadata as 'supported_endpoints'."
67
+ }
68
+ ],
69
+ "items": {
70
+ "type": "string",
71
+ "enum": [
72
+ "complete",
73
+ "chatComplete",
74
+ "embed",
75
+ "rerank",
76
+ "moderate",
77
+ "stream-complete",
78
+ "stream-chatComplete",
79
+ "stream-messages",
80
+ "proxy",
81
+ "imageGenerate",
82
+ "createSpeech",
83
+ "createTranscription",
84
+ "createTranslation",
85
+ "realtime",
86
+ "uploadFile",
87
+ "listFiles",
88
+ "retrieveFile",
89
+ "deleteFile",
90
+ "retrieveFileContent",
91
+ "createBatch",
92
+ "retrieveBatch",
93
+ "cancelBatch",
94
+ "listBatches",
95
+ "getBatchOutput",
96
+ "listFinetunes",
97
+ "createFinetune",
98
+ "retrieveFinetune",
99
+ "cancelFinetune",
100
+ "createModelResponse",
101
+ "getModelResponse",
102
+ "deleteModelResponse",
103
+ "listResponseInputItems",
104
+ "messages"
105
+ ]
106
+ }
107
+ },
108
+ "blockedTypes": {
109
+ "type": "array",
110
+ "label": "Blocked Request Types (Multi-select)",
111
+ "description": [
112
+ {
113
+ "type": "subHeading",
114
+ "text": "Select request types to block. When combined with allowedTypes, blocked types take precedence. Can also be specified in metadata as 'blocked_endpoints'."
115
+ }
116
+ ],
117
+ "items": {
118
+ "type": "string",
119
+ "enum": [
120
+ "complete",
121
+ "chatComplete",
122
+ "embed",
123
+ "rerank",
124
+ "moderate",
125
+ "stream-complete",
126
+ "stream-chatComplete",
127
+ "stream-messages",
128
+ "proxy",
129
+ "imageGenerate",
130
+ "createSpeech",
131
+ "createTranscription",
132
+ "createTranslation",
133
+ "realtime",
134
+ "uploadFile",
135
+ "listFiles",
136
+ "retrieveFile",
137
+ "deleteFile",
138
+ "retrieveFileContent",
139
+ "createBatch",
140
+ "retrieveBatch",
141
+ "cancelBatch",
142
+ "listBatches",
143
+ "getBatchOutput",
144
+ "listFinetunes",
145
+ "createFinetune",
146
+ "retrieveFinetune",
147
+ "cancelFinetune",
148
+ "createModelResponse",
149
+ "getModelResponse",
150
+ "deleteModelResponse",
151
+ "listResponseInputItems",
152
+ "messages"
153
+ ]
154
+ }
155
+ }
156
+ },
157
+ "required": []
158
+ }
159
+ },
160
+ {
161
+ "name": "Sentence Count",
162
+ "id": "sentenceCount",
163
+ "type": "guardrail",
164
+ "supportedHooks": ["beforeRequestHook", "afterRequestHook"],
165
+ "description": [
166
+ {
167
+ "type": "subHeading",
168
+ "text": "Checks if the content contains a certain number of sentences. Ranges allowed."
169
+ }
170
+ ],
171
+ "parameters": {
172
+ "type": "object",
173
+ "properties": {
174
+ "minSentences": {
175
+ "type": "number",
176
+ "label": "Minimum Sentence Count",
177
+ "description": [
178
+ {
179
+ "type": "subHeading",
180
+ "text": "Enter the minimum number of sentences to allow."
181
+ }
182
+ ],
183
+ "default": 0
184
+ },
185
+ "maxSentences": {
186
+ "type": "number",
187
+ "label": "Maximum Sentence Count",
188
+ "description": [
189
+ {
190
+ "type": "subHeading",
191
+ "text": "Enter the maximum number of sentences to allow."
192
+ }
193
+ ],
194
+ "default": 99999
195
+ },
196
+ "not": {
197
+ "type": "boolean",
198
+ "label": "Invert Range Check",
199
+ "description": [
200
+ {
201
+ "type": "subHeading",
202
+ "text": "If true, the verdict will be true when count is outside the range"
203
+ }
204
+ ],
205
+ "default": false
206
+ }
207
+ }
208
+ }
209
+ },
210
+ {
211
+ "name": "Word Count",
212
+ "id": "wordCount",
213
+ "type": "guardrail",
214
+ "supportedHooks": ["beforeRequestHook", "afterRequestHook"],
215
+ "description": [
216
+ {
217
+ "type": "subHeading",
218
+ "text": "Checks if the content contains a certain number of words. Ranges allowed."
219
+ }
220
+ ],
221
+ "parameters": {
222
+ "type": "object",
223
+ "properties": {
224
+ "minWords": {
225
+ "type": "number",
226
+ "label": "Minimum Word Count",
227
+ "description": [
228
+ {
229
+ "type": "subHeading",
230
+ "text": "Enter the minimum number of words to allow."
231
+ }
232
+ ],
233
+ "default": 0
234
+ },
235
+ "maxWords": {
236
+ "type": "number",
237
+ "label": "Maximum Word Count",
238
+ "description": [
239
+ {
240
+ "type": "subHeading",
241
+ "text": "Enter the maximum number of words to allow."
242
+ }
243
+ ],
244
+ "default": 99999
245
+ },
246
+ "not": {
247
+ "type": "boolean",
248
+ "label": "Invert Range Check",
249
+ "description": [
250
+ {
251
+ "type": "subHeading",
252
+ "text": "If true, the verdict will be true when count is outside the range"
253
+ }
254
+ ],
255
+ "default": false
256
+ }
257
+ }
258
+ }
259
+ },
260
+ {
261
+ "name": "Character Count",
262
+ "id": "characterCount",
263
+ "type": "guardrail",
264
+ "supportedHooks": ["beforeRequestHook", "afterRequestHook"],
265
+ "description": [
266
+ {
267
+ "type": "subHeading",
268
+ "text": "Checks if the content contains a certain number of characters. Ranges allowed."
269
+ }
270
+ ],
271
+ "parameters": {
272
+ "type": "object",
273
+ "properties": {
274
+ "minCharacters": {
275
+ "type": "number",
276
+ "label": "Minimum Character Count",
277
+ "description": [
278
+ {
279
+ "type": "subHeading",
280
+ "text": "Enter the minimum number of characters to allow."
281
+ }
282
+ ],
283
+ "default": 0
284
+ },
285
+ "maxCharacters": {
286
+ "type": "number",
287
+ "label": "Maximum Character Count",
288
+ "description": [
289
+ {
290
+ "type": "subHeading",
291
+ "text": "Enter the maximum number of characters to allow."
292
+ }
293
+ ],
294
+ "default": 9999999
295
+ },
296
+ "not": {
297
+ "type": "boolean",
298
+ "label": "Invert Range Check",
299
+ "description": [
300
+ {
301
+ "type": "subHeading",
302
+ "text": "If true, the verdict will be true when count is outside the range"
303
+ }
304
+ ],
305
+ "default": false
306
+ }
307
+ }
308
+ }
309
+ },
310
+ {
311
+ "name": "JSON Schema",
312
+ "id": "jsonSchema",
313
+ "type": "guardrail",
314
+ "supportedHooks": ["afterRequestHook"],
315
+ "description": [
316
+ {
317
+ "type": "subHeading",
318
+ "text": "Check if the response JSON matches a JSON schema."
319
+ }
320
+ ],
321
+ "parameters": {
322
+ "type": "object",
323
+ "properties": {
324
+ "schema": {
325
+ "type": "json",
326
+ "label": "JSON Schema",
327
+ "description": [
328
+ {
329
+ "type": "subHeading",
330
+ "text": "Enter the JSON schema to validate against."
331
+ }
332
+ ]
333
+ },
334
+ "not": {
335
+ "type": "boolean",
336
+ "label": "Invert Schema Match",
337
+ "description": [
338
+ {
339
+ "type": "subHeading",
340
+ "text": "If true, the verdict will be true when schema does not match"
341
+ }
342
+ ],
343
+ "default": false
344
+ }
345
+ },
346
+ "required": ["schema"]
347
+ }
348
+ },
349
+ {
350
+ "name": "JSON Keys",
351
+ "id": "jsonKeys",
352
+ "type": "guardrail",
353
+ "supportedHooks": ["afterRequestHook"],
354
+ "description": [
355
+ {
356
+ "type": "subHeading",
357
+ "text": "Check if the response JSON contains any, all or none of the mentioned keys."
358
+ }
359
+ ],
360
+ "parameters": {
361
+ "type": "object",
362
+ "properties": {
363
+ "keys": {
364
+ "type": "array",
365
+ "label": "JSON Keys",
366
+ "description": [
367
+ {
368
+ "type": "subHeading",
369
+ "text": "Enter the keys to check for."
370
+ }
371
+ ],
372
+ "items": {
373
+ "type": "string"
374
+ }
375
+ },
376
+ "operator": {
377
+ "type": "string",
378
+ "label": "Operator",
379
+ "description": [
380
+ {
381
+ "type": "subHeading",
382
+ "text": "Select the operator to use."
383
+ }
384
+ ],
385
+ "enum": ["any", "all", "none"],
386
+ "default": "any"
387
+ }
388
+ },
389
+ "required": ["keys", "operator"]
390
+ }
391
+ },
392
+ {
393
+ "name": "Contains",
394
+ "id": "contains",
395
+ "type": "guardrail",
396
+ "supportedHooks": ["afterRequestHook"],
397
+ "description": [
398
+ {
399
+ "type": "subHeading",
400
+ "text": "Checks if the content contains any, all or none of the words or phrases"
401
+ }
402
+ ],
403
+ "parameters": {
404
+ "type": "object",
405
+ "properties": {
406
+ "words": {
407
+ "type": "array",
408
+ "label": "Words or Phrases",
409
+ "description": [
410
+ {
411
+ "type": "subHeading",
412
+ "text": "Enter the words or phrases to check for."
413
+ }
414
+ ],
415
+ "items": {
416
+ "type": "string"
417
+ }
418
+ },
419
+ "operator": {
420
+ "type": "string",
421
+ "label": "Operator",
422
+ "description": [
423
+ {
424
+ "type": "subHeading",
425
+ "text": "Select the operator to use."
426
+ }
427
+ ],
428
+ "enum": ["any", "all", "none"],
429
+ "default": "any"
430
+ }
431
+ },
432
+ "required": ["words", "operator"]
433
+ }
434
+ },
435
+ {
436
+ "name": "Valid URLs",
437
+ "id": "validUrls",
438
+ "type": "guardrail",
439
+ "supportedHooks": ["afterRequestHook"],
440
+ "description": [
441
+ {
442
+ "type": "subHeading",
443
+ "text": "Checks if all the URLs mentioned in the content are valid"
444
+ }
445
+ ],
446
+ "parameters": {
447
+ "type": "object",
448
+ "properties": {
449
+ "onlyDNS": {
450
+ "type": "boolean",
451
+ "label": "Only DNS (10x faster)",
452
+ "description": [
453
+ {
454
+ "type": "subHeading",
455
+ "text": "Only check if all URL domains resolve."
456
+ }
457
+ ],
458
+ "default": false
459
+ },
460
+ "not": {
461
+ "type": "boolean",
462
+ "label": "Invert URL Validation",
463
+ "description": [
464
+ {
465
+ "type": "subHeading",
466
+ "text": "If true, the verdict will be true when URLs are invalid"
467
+ }
468
+ ],
469
+ "default": false
470
+ }
471
+ }
472
+ }
473
+ },
474
+ {
475
+ "name": "Webhook",
476
+ "id": "webhook",
477
+ "type": "guardrail",
478
+ "supportedHooks": ["beforeRequest", "afterRequest"],
479
+ "description": [
480
+ {
481
+ "type": "subHeading",
482
+ "text": "Makes a request to a webhook which returns the verdict and data"
483
+ }
484
+ ],
485
+ "parameters": {
486
+ "type": "object",
487
+ "properties": {
488
+ "webhookURL": {
489
+ "type": "string",
490
+ "label": "Webhook URL",
491
+ "description": [
492
+ {
493
+ "type": "subHeading",
494
+ "text": "eg: https://webhook.site/guardrail"
495
+ }
496
+ ]
497
+ },
498
+ "headers": {
499
+ "type": "json",
500
+ "label": "Headers",
501
+ "description": [
502
+ {
503
+ "type": "subHeading",
504
+ "text": "Enter the headers to send with the request."
505
+ }
506
+ ]
507
+ }
508
+ },
509
+ "required": ["webhookURL"]
510
+ }
511
+ },
512
+ {
513
+ "name": "Log",
514
+ "id": "log",
515
+ "type": "guardrail",
516
+ "supportedHooks": ["afterRequest"],
517
+ "description": [
518
+ {
519
+ "type": "subHeading",
520
+ "text": "Makes a request to a log URL and always gives `true` as the verdict."
521
+ }
522
+ ],
523
+ "parameters": {
524
+ "type": "object",
525
+ "properties": {
526
+ "logURL": {
527
+ "type": "string",
528
+ "label": "Log URL",
529
+ "description": [
530
+ {
531
+ "type": "subHeading",
532
+ "text": "eg: https://logging.site/collector"
533
+ }
534
+ ]
535
+ },
536
+ "headers": {
537
+ "type": "json",
538
+ "label": "Headers",
539
+ "description": [
540
+ {
541
+ "type": "subHeading",
542
+ "text": "Enter the headers to send with the request."
543
+ }
544
+ ]
545
+ }
546
+ },
547
+ "required": ["logURL"]
548
+ }
549
+ },
550
+ {
551
+ "name": "Contains Code",
552
+ "id": "containsCode",
553
+ "type": "guardrail",
554
+ "supportedHooks": ["afterRequestHook"],
555
+ "description": [
556
+ {
557
+ "type": "subHeading",
558
+ "text": "Checks if the content contains code of format SQL, Python, TypeScript, etc."
559
+ }
560
+ ],
561
+ "parameters": {
562
+ "type": "object",
563
+ "properties": {
564
+ "format": {
565
+ "type": "string",
566
+ "label": "Code Format",
567
+ "description": [
568
+ {
569
+ "type": "subHeading",
570
+ "text": "Select the code format to check for."
571
+ }
572
+ ],
573
+ "enum": [
574
+ "SQL",
575
+ "Python",
576
+ "TypeScript",
577
+ "JavaScript",
578
+ "Java",
579
+ "C#",
580
+ "C++",
581
+ "C",
582
+ "Ruby",
583
+ "PHP",
584
+ "Swift",
585
+ "Kotlin",
586
+ "Go",
587
+ "Rust",
588
+ "Scala",
589
+ "R",
590
+ "Perl",
591
+ "Shell",
592
+ "HTML",
593
+ "CSS",
594
+ "XML",
595
+ "JSON",
596
+ "YAML",
597
+ "Markdown",
598
+ "Dockerfile"
599
+ ]
600
+ },
601
+ "not": {
602
+ "type": "boolean",
603
+ "label": "Invert Code Check",
604
+ "description": [
605
+ {
606
+ "type": "subHeading",
607
+ "text": "If true, the verdict will be true when code is not found"
608
+ }
609
+ ],
610
+ "default": false
611
+ }
612
+ },
613
+ "required": ["format"]
614
+ }
615
+ },
616
+ {
617
+ "name": "Uppercase check",
618
+ "id": "alluppercase",
619
+ "type": "guardrail",
620
+ "supportedHooks": ["beforeRequest", "afterRequest"],
621
+ "description": [
622
+ {
623
+ "type": "subHeading",
624
+ "text": "Checks if content has all uppercase letters."
625
+ }
626
+ ],
627
+ "parameters": {
628
+ "type": "object",
629
+ "properties": {
630
+ "not": {
631
+ "type": "boolean",
632
+ "label": "Invert Case Check",
633
+ "description": [
634
+ {
635
+ "type": "subHeading",
636
+ "text": "If true, the verdict will be true when text is not all uppercase"
637
+ }
638
+ ],
639
+ "default": false
640
+ }
641
+ }
642
+ }
643
+ },
644
+ {
645
+ "name": "Ends With",
646
+ "id": "endsWith",
647
+ "type": "guardrail",
648
+ "supportedHooks": ["beforeRequest", "afterRequest"],
649
+ "description": [
650
+ {
651
+ "type": "subHeading",
652
+ "text": "Check if the content ends with a specified string."
653
+ }
654
+ ],
655
+ "parameters": {
656
+ "type": "object",
657
+ "properties": {
658
+ "suffix": {
659
+ "type": "string",
660
+ "label": "Suffix",
661
+ "description": [
662
+ {
663
+ "type": "subHeading",
664
+ "text": "Enter the suffix to check for."
665
+ }
666
+ ]
667
+ },
668
+ "not": {
669
+ "type": "boolean",
670
+ "label": "Invert Suffix Check",
671
+ "description": [
672
+ {
673
+ "type": "subHeading",
674
+ "text": "If true, the verdict will be true when text does not end with suffix"
675
+ }
676
+ ],
677
+ "default": false
678
+ }
679
+ },
680
+ "required": ["suffix"]
681
+ }
682
+ },
683
+ {
684
+ "name": "Lowercase check",
685
+ "id": "alllowercase",
686
+ "type": "guardrail",
687
+ "supportedHooks": ["beforeRequest", "afterRequest"],
688
+ "description": [
689
+ {
690
+ "type": "subHeading",
691
+ "text": "Checks if content has all lowercase letters."
692
+ }
693
+ ],
694
+ "parameters": {
695
+ "type": "object",
696
+ "properties": {
697
+ "not": {
698
+ "type": "boolean",
699
+ "label": "Invert Case Check",
700
+ "description": [
701
+ {
702
+ "type": "subHeading",
703
+ "text": "If true, the verdict will be true when text is not all lowercase"
704
+ }
705
+ ],
706
+ "default": false
707
+ }
708
+ }
709
+ }
710
+ },
711
+ {
712
+ "name": "Allowed Models",
713
+ "id": "modelwhitelist",
714
+ "type": "guardrail",
715
+ "supportedHooks": ["beforeRequestHook"],
716
+ "description": [
717
+ {
718
+ "type": "subHeading",
719
+ "text": "Blocks any request whose model isn’t on this list."
720
+ }
721
+ ],
722
+ "parameters": {
723
+ "type": "object",
724
+ "properties": {
725
+ "models": {
726
+ "type": "array",
727
+ "label": "Model list",
728
+ "description": [
729
+ {
730
+ "type": "subHeading",
731
+ "text": "Enter the allowed models. e.g. gpt-4o, llama-3-70b, mixtral-8x7b"
732
+ }
733
+ ],
734
+ "items": {
735
+ "type": "string"
736
+ }
737
+ },
738
+ "not": {
739
+ "type": "boolean",
740
+ "label": "Invert Model Check",
741
+ "description": [
742
+ {
743
+ "type": "subHeading",
744
+ "text": "When on, any model in the list is blocked instead of allowed."
745
+ }
746
+ ],
747
+ "default": false
748
+ }
749
+ },
750
+ "required": ["models"]
751
+ }
752
+ },
753
+ {
754
+ "name": "Model Rules",
755
+ "id": "modelRules",
756
+ "type": "guardrail",
757
+ "supportedHooks": ["beforeRequestHook"],
758
+ "description": [
759
+ {
760
+ "type": "subHeading",
761
+ "text": "Allow requests based on metadata-driven rules mapping to allowed models."
762
+ }
763
+ ],
764
+ "parameters": {
765
+ "type": "object",
766
+ "properties": {
767
+ "rules": {
768
+ "type": "object",
769
+ "label": "Rules object: {\"defaults\": [\"model\"], \"metadata\": {\"key\": {\"value\": [\"models\"]}}}",
770
+ "description": [
771
+ {
772
+ "type": "text",
773
+ "text": "Overrides model list using metadata-based routing."
774
+ }
775
+ ]
776
+ },
777
+ "not": {
778
+ "type": "boolean",
779
+ "label": "Invert Model Check",
780
+ "description": [
781
+ {
782
+ "type": "text",
783
+ "text": "When on, any model resolved by rules is blocked instead of allowed."
784
+ }
785
+ ],
786
+ "default": false
787
+ }
788
+ },
789
+ "required": ["rules"]
790
+ }
791
+ },
792
+ {
793
+ "name": "JWT",
794
+ "id": "jwt",
795
+ "type": "guardrail",
796
+ "supportedHooks": ["beforeRequestHook"],
797
+ "description": [
798
+ {
799
+ "type": "subHeading",
800
+ "text": "Check if the JWT token is valid."
801
+ }
802
+ ],
803
+ "parameters": {
804
+ "type": "object",
805
+ "properties": {
806
+ "jwksUri": {
807
+ "type": "string",
808
+ "label": "JWKS URI",
809
+ "description": [
810
+ {
811
+ "type": "subHeading",
812
+ "text": "Enter the JWKS URI of the JWT token."
813
+ }
814
+ ]
815
+ },
816
+ "headerKey": {
817
+ "type": "string",
818
+ "label": "Header Key",
819
+ "description": [
820
+ {
821
+ "type": "subHeading",
822
+ "text": "Enter the header key to check for the JWT token."
823
+ }
824
+ ]
825
+ },
826
+ "cacheMaxAge": {
827
+ "type": "number",
828
+ "label": "Cache Max Age",
829
+ "description": [
830
+ {
831
+ "type": "subHeading",
832
+ "text": "Enter the cache max age in seconds."
833
+ }
834
+ ],
835
+ "default": 86400
836
+ },
837
+ "clockTolerance": {
838
+ "type": "number",
839
+ "label": "Clock Tolerance",
840
+ "description": [
841
+ {
842
+ "type": "subHeading",
843
+ "text": "Enter the clock tolerance in seconds."
844
+ }
845
+ ],
846
+ "default": 5
847
+ },
848
+ "maxTokenAge": {
849
+ "type": "string",
850
+ "label": "Max Token Age",
851
+ "description": [
852
+ {
853
+ "type": "subHeading",
854
+ "text": "Enter the max token age."
855
+ }
856
+ ],
857
+ "default": "1d"
858
+ }
859
+ },
860
+ "required": ["jwksUri", "headerKey"]
861
+ }
862
+ },
863
+ {
864
+ "name": "Required Metadata Keys",
865
+ "id": "requiredMetadataKeys",
866
+ "type": "guardrail",
867
+ "supportedHooks": ["beforeRequestHook"],
868
+ "description": [
869
+ {
870
+ "type": "subHeading",
871
+ "text": "Checks if the metadata contains all the required keys"
872
+ }
873
+ ],
874
+ "parameters": {
875
+ "type": "object",
876
+ "properties": {
877
+ "metadataKeys": {
878
+ "type": "array",
879
+ "label": "Metadata Keys",
880
+ "description": [
881
+ {
882
+ "type": "subHeading",
883
+ "text": "Enter the metadata keys to check for."
884
+ }
885
+ ],
886
+ "items": {
887
+ "type": "string"
888
+ }
889
+ },
890
+ "operator": {
891
+ "type": "string",
892
+ "label": "Operator",
893
+ "description": [
894
+ {
895
+ "type": "subHeading",
896
+ "text": "Select the operator to use."
897
+ }
898
+ ],
899
+ "enum": ["all", "any", "none"],
900
+ "default": "all"
901
+ }
902
+ },
903
+ "required": ["metadataKeys", "operator"]
904
+ }
905
+ },
906
+ {
907
+ "name": "Add Prefix",
908
+ "id": "addPrefix",
909
+ "type": "transformer",
910
+ "supportedHooks": ["beforeRequestHook"],
911
+ "description": [
912
+ {
913
+ "type": "subHeading",
914
+ "text": "Adds a configurable prefix to the user's prompt or messages before sending to the AI model"
915
+ }
916
+ ],
917
+ "parameters": {
918
+ "type": "object",
919
+ "properties": {
920
+ "prefix": {
921
+ "type": "string",
922
+ "label": "Prefix Text",
923
+ "description": [
924
+ {
925
+ "type": "subHeading",
926
+ "text": "The text to prepend to the user's prompt or message"
927
+ }
928
+ ],
929
+ "default": "Please respond helpfully and accurately to the following: "
930
+ },
931
+ "applyToRole": {
932
+ "type": "string",
933
+ "label": "Apply to Role",
934
+ "description": [
935
+ {
936
+ "type": "subHeading",
937
+ "text": "For chat completions, which message role to apply the prefix to"
938
+ }
939
+ ],
940
+ "enum": ["user", "system", "assistant"],
941
+ "default": "user"
942
+ },
943
+ "addToExisting": {
944
+ "type": "boolean",
945
+ "label": "Add to Existing Message",
946
+ "description": [
947
+ {
948
+ "type": "subHeading",
949
+ "text": "If true, adds prefix to existing message. If false, creates new message with prefix"
950
+ }
951
+ ],
952
+ "default": true
953
+ },
954
+ "onlyIfEmpty": {
955
+ "type": "boolean",
956
+ "label": "Only Apply If Role Empty",
957
+ "description": [
958
+ {
959
+ "type": "subHeading",
960
+ "text": "Only apply prefix if no message exists for the specified role (useful for system messages)"
961
+ }
962
+ ],
963
+ "default": false
964
+ }
965
+ },
966
+ "required": ["prefix"]
967
+ }
968
+ },
969
+ {
970
+ "name": "Not Null",
971
+ "id": "notNull",
972
+ "type": "guardrail",
973
+ "supportedHooks": ["afterRequestHook"],
974
+ "description": [
975
+ {
976
+ "type": "subHeading",
977
+ "text": "Checks if the response content is not null, undefined, or empty. Useful for detecting when an AI model returns no content."
978
+ }
979
+ ],
980
+ "parameters": {
981
+ "type": "object",
982
+ "properties": {
983
+ "not": {
984
+ "type": "boolean",
985
+ "label": "Invert Check",
986
+ "description": [
987
+ {
988
+ "type": "subHeading",
989
+ "text": "If true, the verdict will be true when content IS null (inverts the check)"
990
+ }
991
+ ],
992
+ "default": false
993
+ }
994
+ }
995
+ }
996
+ }
997
+ ]
998
+ }