@daocloud-proto/hydra 0.17.0-rc1-dev-6 → 0.17.0-rc1-dev-9
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,32 @@ export enum PluginAction {
|
|
|
29
38
|
PLUGIN_ACTION_REPLACE_MASK = "PLUGIN_ACTION_REPLACE_MASK",
|
|
30
39
|
}
|
|
31
40
|
|
|
41
|
+
export enum CheckPhase {
|
|
42
|
+
CHECK_PHASE_UNSPECIFIED = "CHECK_PHASE_UNSPECIFIED",
|
|
43
|
+
CHECK_PHASE_INPUT = "CHECK_PHASE_INPUT",
|
|
44
|
+
CHECK_PHASE_OUTPUT = "CHECK_PHASE_OUTPUT",
|
|
45
|
+
CHECK_PHASE_BOTH = "CHECK_PHASE_BOTH",
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export enum ExternalDetectProvider {
|
|
49
|
+
EXTERNAL_DETECT_PROVIDER_UNSPECIFIED = "EXTERNAL_DETECT_PROVIDER_UNSPECIFIED",
|
|
50
|
+
EXTERNAL_DETECT_PROVIDER_NSFOCUS = "EXTERNAL_DETECT_PROVIDER_NSFOCUS",
|
|
51
|
+
EXTERNAL_DETECT_PROVIDER_CUSTOM = "EXTERNAL_DETECT_PROVIDER_CUSTOM",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export enum SafetyCategory {
|
|
55
|
+
SAFETY_CATEGORY_UNSPECIFIED = "SAFETY_CATEGORY_UNSPECIFIED",
|
|
56
|
+
SAFETY_CATEGORY_VIOLENT = "SAFETY_CATEGORY_VIOLENT",
|
|
57
|
+
SAFETY_CATEGORY_ILLEGAL = "SAFETY_CATEGORY_ILLEGAL",
|
|
58
|
+
SAFETY_CATEGORY_SEXUAL = "SAFETY_CATEGORY_SEXUAL",
|
|
59
|
+
SAFETY_CATEGORY_PII = "SAFETY_CATEGORY_PII",
|
|
60
|
+
SAFETY_CATEGORY_SELF_HARM = "SAFETY_CATEGORY_SELF_HARM",
|
|
61
|
+
SAFETY_CATEGORY_UNETHICAL = "SAFETY_CATEGORY_UNETHICAL",
|
|
62
|
+
SAFETY_CATEGORY_POLITICAL = "SAFETY_CATEGORY_POLITICAL",
|
|
63
|
+
SAFETY_CATEGORY_COPYRIGHT = "SAFETY_CATEGORY_COPYRIGHT",
|
|
64
|
+
SAFETY_CATEGORY_JAILBREAK = "SAFETY_CATEGORY_JAILBREAK",
|
|
65
|
+
}
|
|
66
|
+
|
|
32
67
|
export enum GuardrailsPlugin {
|
|
33
68
|
GUARDRAILS_PLUGIN_UNSPECIFIED = "GUARDRAILS_PLUGIN_UNSPECIFIED",
|
|
34
69
|
GUARDRAILS_PLUGIN_CONTAINS = "GUARDRAILS_PLUGIN_CONTAINS",
|
|
@@ -36,6 +71,7 @@ export enum GuardrailsPlugin {
|
|
|
36
71
|
GUARDRAILS_PLUGIN_JSON_SCHEMA = "GUARDRAILS_PLUGIN_JSON_SCHEMA",
|
|
37
72
|
GUARDRAILS_PLUGIN_JWT = "GUARDRAILS_PLUGIN_JWT",
|
|
38
73
|
GUARDRAILS_PLUGIN_MODEL_WHITELIST = "GUARDRAILS_PLUGIN_MODEL_WHITELIST",
|
|
74
|
+
GUARDRAILS_PLUGIN_EXTERNAL_DETECT = "GUARDRAILS_PLUGIN_EXTERNAL_DETECT",
|
|
39
75
|
}
|
|
40
76
|
|
|
41
77
|
export enum GuardrailsLevel {
|
|
@@ -62,6 +98,7 @@ export type AIGuardrailsConfig = {
|
|
|
62
98
|
cluster?: string
|
|
63
99
|
creationTime?: GoogleProtobufTimestamp.Timestamp
|
|
64
100
|
updateTime?: GoogleProtobufTimestamp.Timestamp
|
|
101
|
+
externalDetect?: ExternalDetectPlugin
|
|
65
102
|
}
|
|
66
103
|
|
|
67
104
|
export type RegexMatchPlugin = {
|
|
@@ -70,6 +107,7 @@ export type RegexMatchPlugin = {
|
|
|
70
107
|
matchStrategy?: MatchStrategy
|
|
71
108
|
action?: PluginAction
|
|
72
109
|
responses?: string[]
|
|
110
|
+
checkPhase?: CheckPhase
|
|
73
111
|
}
|
|
74
112
|
|
|
75
113
|
export type ContainsPlugin = {
|
|
@@ -78,6 +116,7 @@ export type ContainsPlugin = {
|
|
|
78
116
|
matchStrategy?: MatchStrategy
|
|
79
117
|
action?: PluginAction
|
|
80
118
|
responses?: string[]
|
|
119
|
+
checkPhase?: CheckPhase
|
|
81
120
|
}
|
|
82
121
|
|
|
83
122
|
export type JsonSchemaPlugin = {
|
|
@@ -99,6 +138,44 @@ export type ModelWhitelistPlugin = {
|
|
|
99
138
|
action?: PluginAction
|
|
100
139
|
}
|
|
101
140
|
|
|
141
|
+
export type CategoryThreshold = {
|
|
142
|
+
category?: SafetyCategory
|
|
143
|
+
threshold?: number
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type CustomProviderConfig = {
|
|
147
|
+
model?: string
|
|
148
|
+
categories?: CategoryThreshold[]
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type NsfocusProviderConfig = {
|
|
152
|
+
accessKey?: string
|
|
153
|
+
secretKey?: string
|
|
154
|
+
appId?: string
|
|
155
|
+
vAppId?: string
|
|
156
|
+
vAppName?: string
|
|
157
|
+
policyId?: string
|
|
158
|
+
enableImage?: boolean
|
|
159
|
+
enableAudio?: boolean
|
|
160
|
+
enableVideo?: boolean
|
|
161
|
+
enableDoc?: boolean
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
type BaseExternalDetectPlugin = {
|
|
166
|
+
enabled?: boolean
|
|
167
|
+
endpoint?: string
|
|
168
|
+
header?: {[key: string]: string}
|
|
169
|
+
action?: PluginAction
|
|
170
|
+
timeoutMs?: number
|
|
171
|
+
provider?: ExternalDetectProvider
|
|
172
|
+
checkInput?: boolean
|
|
173
|
+
checkOutput?: boolean
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export type ExternalDetectPlugin = BaseExternalDetectPlugin
|
|
177
|
+
& OneOf<{ custom: CustomProviderConfig; nsfocus: NsfocusProviderConfig }>
|
|
178
|
+
|
|
102
179
|
export type GetAIGuardrailsConfigRequest = {
|
|
103
180
|
cluster?: string
|
|
104
181
|
}
|
|
@@ -127,6 +204,7 @@ export type QueryAIAuditLogRequest = {
|
|
|
127
204
|
pluginId?: GuardrailsPlugin
|
|
128
205
|
level?: GuardrailsLevel
|
|
129
206
|
routeName?: string
|
|
207
|
+
detectionPhase?: string
|
|
130
208
|
}
|
|
131
209
|
|
|
132
210
|
export type AIAuditLog = {
|
|
@@ -143,6 +221,7 @@ export type AIAuditLog = {
|
|
|
143
221
|
functionName?: string
|
|
144
222
|
functionArgs?: string
|
|
145
223
|
matchRule?: string
|
|
224
|
+
detectionPhase?: string
|
|
146
225
|
}
|
|
147
226
|
|
|
148
227
|
export type QueryAIAuditLogResponse = {
|
|
@@ -108,12 +108,17 @@ export type MAASCapabilityRoute = {
|
|
|
108
108
|
upstreams?: MAASCapabilityUpstream[]
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
export type MAASCapabilityConfig = {
|
|
112
|
+
path?: string
|
|
113
|
+
compatibility?: string
|
|
114
|
+
}
|
|
115
|
+
|
|
111
116
|
export type MAASCapabilityUpstream = {
|
|
112
117
|
modelId?: string
|
|
113
118
|
baseUrl?: string
|
|
114
|
-
capabilityPaths?: {[key: string]: string}
|
|
115
119
|
apiKey?: string
|
|
116
120
|
status?: MAASBackendStatus
|
|
121
|
+
capabilityConfigs?: {[key: string]: MAASCapabilityConfig}
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
export type UpstreamModel = {
|
|
@@ -330,6 +330,60 @@ export type GetModelSupportFeatureConfigResponse = {
|
|
|
330
330
|
config?: ModelSupportFeatureConfig
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
export type ListModelCapabilityCompatibilitiesRequest = {
|
|
334
|
+
capability?: string
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export type ModelCapabilityCompatibilityField = {
|
|
338
|
+
name?: string
|
|
339
|
+
displayName?: string
|
|
340
|
+
valueType?: string
|
|
341
|
+
required?: boolean
|
|
342
|
+
defaultValue?: string
|
|
343
|
+
allowedValues?: string[]
|
|
344
|
+
description?: string
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export type ModelCapabilityCompatibilityAction = {
|
|
348
|
+
kind?: string
|
|
349
|
+
field?: string
|
|
350
|
+
targetField?: string
|
|
351
|
+
fixedValue?: string
|
|
352
|
+
description?: string
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export type ModelCapabilityCompatibility = {
|
|
356
|
+
compatibility?: string
|
|
357
|
+
displayName?: string
|
|
358
|
+
description?: string
|
|
359
|
+
requestFields?: ModelCapabilityCompatibilityField[]
|
|
360
|
+
requestActions?: ModelCapabilityCompatibilityAction[]
|
|
361
|
+
responseMode?: string
|
|
362
|
+
responseActions?: ModelCapabilityCompatibilityAction[]
|
|
363
|
+
errorPolicy?: string
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export type ListModelCapabilityCompatibilitiesResponse = {
|
|
367
|
+
capability?: string
|
|
368
|
+
items?: ModelCapabilityCompatibility[]
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export type ListModelCapabilityCompatibilityOptionsRequest = {
|
|
372
|
+
capability?: string
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export type ModelCapabilityCompatibilityOption = {
|
|
376
|
+
compatibility?: string
|
|
377
|
+
displayName?: string
|
|
378
|
+
description?: string
|
|
379
|
+
requestFields?: ModelCapabilityCompatibilityField[]
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export type ListModelCapabilityCompatibilityOptionsResponse = {
|
|
383
|
+
capability?: string
|
|
384
|
+
items?: ModelCapabilityCompatibilityOption[]
|
|
385
|
+
}
|
|
386
|
+
|
|
333
387
|
export class ModelManagement {
|
|
334
388
|
static GetModel(req: SingleModelRequest, initReq?: fm.InitReq): Promise<Model> {
|
|
335
389
|
return fm.fetchReq<SingleModelRequest, Model>(`/apis/hydra.io/v1alpha1/models/${req["modelId"]}?${fm.renderURLSearchParams(req, ["modelId"])}`, {...initReq, method: "GET"})
|
|
@@ -382,4 +436,10 @@ export class ModelConfigManagement {
|
|
|
382
436
|
static GetModelSupportFeatureConfig(req: GetModelSupportFeatureConfigRequest, initReq?: fm.InitReq): Promise<GetModelSupportFeatureConfigResponse> {
|
|
383
437
|
return fm.fetchReq<GetModelSupportFeatureConfigRequest, GetModelSupportFeatureConfigResponse>(`/apis/hydra.io/v1alpha1/model-support-features/config?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
384
438
|
}
|
|
439
|
+
static ListModelCapabilityCompatibilities(req: ListModelCapabilityCompatibilitiesRequest, initReq?: fm.InitReq): Promise<ListModelCapabilityCompatibilitiesResponse> {
|
|
440
|
+
return fm.fetchReq<ListModelCapabilityCompatibilitiesRequest, ListModelCapabilityCompatibilitiesResponse>(`/apis/hydra.io/v1alpha1/model-capabilities/${req["capability"]}/compatibilities?${fm.renderURLSearchParams(req, ["capability"])}`, {...initReq, method: "GET"})
|
|
441
|
+
}
|
|
442
|
+
static ListModelCapabilityCompatibilityOptions(req: ListModelCapabilityCompatibilityOptionsRequest, initReq?: fm.InitReq): Promise<ListModelCapabilityCompatibilityOptionsResponse> {
|
|
443
|
+
return fm.fetchReq<ListModelCapabilityCompatibilityOptionsRequest, ListModelCapabilityCompatibilityOptionsResponse>(`/apis/hydra.io/v1alpha1/model-capabilities/${req["capability"]}/compatibility-options?${fm.renderURLSearchParams(req, ["capability"])}`, {...initReq, method: "GET"})
|
|
444
|
+
}
|
|
385
445
|
}
|