@daocloud-proto/hydra 0.17.0-rc1-dev-7 → 0.17.0-rc1-dev-10

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.
@@ -9,6 +9,15 @@ import * as fm from "../../../fetch.pb"
9
9
  import * as GoogleApiHttpbody from "../../../google/api/httpbody.pb"
10
10
  import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
11
11
 
12
+ type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
13
+ type OneOf<T> =
14
+ | { [k in keyof T]?: undefined }
15
+ | (
16
+ keyof T extends infer K ?
17
+ (K extends string & keyof T ? { [k in K]: T[K] } & Absent<T, K>
18
+ : never)
19
+ : never);
20
+
12
21
  export enum BlockStrategy {
13
22
  BLOCK_STRATEGY_UNSPECIFIED = "BLOCK_STRATEGY_UNSPECIFIED",
14
23
  BLOCK_STRATEGY_ANY = "BLOCK_STRATEGY_ANY",
@@ -29,6 +38,25 @@ export enum PluginAction {
29
38
  PLUGIN_ACTION_REPLACE_MASK = "PLUGIN_ACTION_REPLACE_MASK",
30
39
  }
31
40
 
41
+ export enum ExternalDetectProvider {
42
+ EXTERNAL_DETECT_PROVIDER_UNSPECIFIED = "EXTERNAL_DETECT_PROVIDER_UNSPECIFIED",
43
+ EXTERNAL_DETECT_PROVIDER_NSFOCUS = "EXTERNAL_DETECT_PROVIDER_NSFOCUS",
44
+ EXTERNAL_DETECT_PROVIDER_CUSTOM = "EXTERNAL_DETECT_PROVIDER_CUSTOM",
45
+ }
46
+
47
+ export enum SafetyCategory {
48
+ SAFETY_CATEGORY_UNSPECIFIED = "SAFETY_CATEGORY_UNSPECIFIED",
49
+ SAFETY_CATEGORY_VIOLENT = "SAFETY_CATEGORY_VIOLENT",
50
+ SAFETY_CATEGORY_ILLEGAL = "SAFETY_CATEGORY_ILLEGAL",
51
+ SAFETY_CATEGORY_SEXUAL = "SAFETY_CATEGORY_SEXUAL",
52
+ SAFETY_CATEGORY_PII = "SAFETY_CATEGORY_PII",
53
+ SAFETY_CATEGORY_SELF_HARM = "SAFETY_CATEGORY_SELF_HARM",
54
+ SAFETY_CATEGORY_UNETHICAL = "SAFETY_CATEGORY_UNETHICAL",
55
+ SAFETY_CATEGORY_POLITICAL = "SAFETY_CATEGORY_POLITICAL",
56
+ SAFETY_CATEGORY_COPYRIGHT = "SAFETY_CATEGORY_COPYRIGHT",
57
+ SAFETY_CATEGORY_JAILBREAK = "SAFETY_CATEGORY_JAILBREAK",
58
+ }
59
+
32
60
  export enum GuardrailsPlugin {
33
61
  GUARDRAILS_PLUGIN_UNSPECIFIED = "GUARDRAILS_PLUGIN_UNSPECIFIED",
34
62
  GUARDRAILS_PLUGIN_CONTAINS = "GUARDRAILS_PLUGIN_CONTAINS",
@@ -36,6 +64,7 @@ export enum GuardrailsPlugin {
36
64
  GUARDRAILS_PLUGIN_JSON_SCHEMA = "GUARDRAILS_PLUGIN_JSON_SCHEMA",
37
65
  GUARDRAILS_PLUGIN_JWT = "GUARDRAILS_PLUGIN_JWT",
38
66
  GUARDRAILS_PLUGIN_MODEL_WHITELIST = "GUARDRAILS_PLUGIN_MODEL_WHITELIST",
67
+ GUARDRAILS_PLUGIN_EXTERNAL_DETECT = "GUARDRAILS_PLUGIN_EXTERNAL_DETECT",
39
68
  }
40
69
 
41
70
  export enum GuardrailsLevel {
@@ -62,6 +91,7 @@ export type AIGuardrailsConfig = {
62
91
  cluster?: string
63
92
  creationTime?: GoogleProtobufTimestamp.Timestamp
64
93
  updateTime?: GoogleProtobufTimestamp.Timestamp
94
+ externalDetect?: ExternalDetectPlugin
65
95
  }
66
96
 
67
97
  export type RegexMatchPlugin = {
@@ -70,6 +100,8 @@ export type RegexMatchPlugin = {
70
100
  matchStrategy?: MatchStrategy
71
101
  action?: PluginAction
72
102
  responses?: string[]
103
+ checkInput?: boolean
104
+ checkOutput?: boolean
73
105
  }
74
106
 
75
107
  export type ContainsPlugin = {
@@ -78,6 +110,8 @@ export type ContainsPlugin = {
78
110
  matchStrategy?: MatchStrategy
79
111
  action?: PluginAction
80
112
  responses?: string[]
113
+ checkInput?: boolean
114
+ checkOutput?: boolean
81
115
  }
82
116
 
83
117
  export type JsonSchemaPlugin = {
@@ -99,6 +133,40 @@ export type ModelWhitelistPlugin = {
99
133
  action?: PluginAction
100
134
  }
101
135
 
136
+ export type CategoryThreshold = {
137
+ category?: SafetyCategory
138
+ threshold?: number
139
+ }
140
+
141
+ export type CustomProviderConfig = {
142
+ model?: string
143
+ categories?: CategoryThreshold[]
144
+ }
145
+
146
+ export type NsfocusProviderConfig = {
147
+ accessKey?: string
148
+ secretKey?: string
149
+ appId?: string
150
+ vAppId?: string
151
+ vAppName?: string
152
+ policyId?: string
153
+ }
154
+
155
+
156
+ type BaseExternalDetectPlugin = {
157
+ enabled?: boolean
158
+ endpoint?: string
159
+ header?: {[key: string]: string}
160
+ action?: PluginAction
161
+ timeoutMs?: number
162
+ provider?: ExternalDetectProvider
163
+ checkInput?: boolean
164
+ checkOutput?: boolean
165
+ }
166
+
167
+ export type ExternalDetectPlugin = BaseExternalDetectPlugin
168
+ & OneOf<{ custom: CustomProviderConfig; nsfocus: NsfocusProviderConfig }>
169
+
102
170
  export type GetAIGuardrailsConfigRequest = {
103
171
  cluster?: string
104
172
  }
@@ -127,6 +195,7 @@ export type QueryAIAuditLogRequest = {
127
195
  pluginId?: GuardrailsPlugin
128
196
  level?: GuardrailsLevel
129
197
  routeName?: string
198
+ detectionPhase?: string
130
199
  }
131
200
 
132
201
  export type AIAuditLog = {
@@ -143,6 +212,7 @@ export type AIAuditLog = {
143
212
  functionName?: string
144
213
  functionArgs?: string
145
214
  matchRule?: string
215
+ detectionPhase?: string
146
216
  }
147
217
 
148
218
  export type QueryAIAuditLogResponse = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daocloud-proto/hydra",
3
- "version": "v0.17.0-rc1-dev-7",
3
+ "version": "v0.17.0-rc1-dev-10",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"