@daocloud-proto/hydra 0.0.0-dev-9fdfdd0c → 0.0.0-dev-cb927b7b
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.
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/*
|
|
4
|
+
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
|
+
import * as fm from "../../../fetch.pb"
|
|
9
|
+
import * as GoogleApiHttpbody from "../../../google/api/httpbody.pb"
|
|
10
|
+
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
11
|
+
|
|
12
|
+
export enum BlockStrategy {
|
|
13
|
+
BLOCK_STRATEGY_UNSPECIFIED = "BLOCK_STRATEGY_UNSPECIFIED",
|
|
14
|
+
BLOCK_STRATEGY_ANY = "BLOCK_STRATEGY_ANY",
|
|
15
|
+
BLOCK_STRATEGY_ALL = "BLOCK_STRATEGY_ALL",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum MatchStrategy {
|
|
19
|
+
MATCH_STRATEGY_UNSPECIFIED = "MATCH_STRATEGY_UNSPECIFIED",
|
|
20
|
+
MATCH_STRATEGY_ANY = "MATCH_STRATEGY_ANY",
|
|
21
|
+
MATCH_STRATEGY_ALL = "MATCH_STRATEGY_ALL",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum PluginAction {
|
|
25
|
+
PLUGIN_ACTION_UNSPECIFIED = "PLUGIN_ACTION_UNSPECIFIED",
|
|
26
|
+
PLUGIN_ACTION_BLOCK = "PLUGIN_ACTION_BLOCK",
|
|
27
|
+
PLUGIN_ACTION_LOG = "PLUGIN_ACTION_LOG",
|
|
28
|
+
PLUGIN_ACTION_REPLACE_RANDOM = "PLUGIN_ACTION_REPLACE_RANDOM",
|
|
29
|
+
PLUGIN_ACTION_REPLACE_MASK = "PLUGIN_ACTION_REPLACE_MASK",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum GuardrailsPlugin {
|
|
33
|
+
GUARDRAILS_PLUGIN_UNSPECIFIED = "GUARDRAILS_PLUGIN_UNSPECIFIED",
|
|
34
|
+
GUARDRAILS_PLUGIN_CONTAINS = "GUARDRAILS_PLUGIN_CONTAINS",
|
|
35
|
+
GUARDRAILS_PLUGIN_REGEX = "GUARDRAILS_PLUGIN_REGEX",
|
|
36
|
+
GUARDRAILS_PLUGIN_JSON_SCHEMA = "GUARDRAILS_PLUGIN_JSON_SCHEMA",
|
|
37
|
+
GUARDRAILS_PLUGIN_JWT = "GUARDRAILS_PLUGIN_JWT",
|
|
38
|
+
GUARDRAILS_PLUGIN_MODEL_WHITELIST = "GUARDRAILS_PLUGIN_MODEL_WHITELIST",
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export enum GuardrailsLevel {
|
|
42
|
+
GUARDRAILS_LEVEL_UNSPECIFIED = "GUARDRAILS_LEVEL_UNSPECIFIED",
|
|
43
|
+
GUARDRAILS_LEVEL_HIGH = "GUARDRAILS_LEVEL_HIGH",
|
|
44
|
+
GUARDRAILS_LEVEL_MEDIUM = "GUARDRAILS_LEVEL_MEDIUM",
|
|
45
|
+
GUARDRAILS_LEVEL_LOW = "GUARDRAILS_LEVEL_LOW",
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export enum ExportType {
|
|
49
|
+
EXPORT_TYPE_UNSPECIFIED = "EXPORT_TYPE_UNSPECIFIED",
|
|
50
|
+
EXPORT_TYPE_CSV = "EXPORT_TYPE_CSV",
|
|
51
|
+
EXPORT_TYPE_EXCEL = "EXPORT_TYPE_EXCEL",
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type AIGuardrailsConfig = {
|
|
55
|
+
blockStrategy?: BlockStrategy
|
|
56
|
+
denyMessage?: string
|
|
57
|
+
regexMatch?: RegexMatchPlugin
|
|
58
|
+
contains?: ContainsPlugin
|
|
59
|
+
jsonSchema?: JsonSchemaPlugin
|
|
60
|
+
jwt?: JWTPlugin
|
|
61
|
+
modelWhitelist?: ModelWhitelistPlugin
|
|
62
|
+
cluster?: string
|
|
63
|
+
creationTime?: GoogleProtobufTimestamp.Timestamp
|
|
64
|
+
updateTime?: GoogleProtobufTimestamp.Timestamp
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type RegexMatchPlugin = {
|
|
68
|
+
enabled?: boolean
|
|
69
|
+
patterns?: string[]
|
|
70
|
+
matchStrategy?: MatchStrategy
|
|
71
|
+
action?: PluginAction
|
|
72
|
+
responses?: string[]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type ContainsPlugin = {
|
|
76
|
+
enabled?: boolean
|
|
77
|
+
words?: string[]
|
|
78
|
+
matchStrategy?: MatchStrategy
|
|
79
|
+
action?: PluginAction
|
|
80
|
+
responses?: string[]
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type JsonSchemaPlugin = {
|
|
84
|
+
enabled?: boolean
|
|
85
|
+
action?: PluginAction
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type JWTPlugin = {
|
|
89
|
+
enabled?: boolean
|
|
90
|
+
action?: PluginAction
|
|
91
|
+
headerKey?: string
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type ModelWhitelistPlugin = {
|
|
95
|
+
enabled?: boolean
|
|
96
|
+
models?: string[]
|
|
97
|
+
isBlocklist?: boolean
|
|
98
|
+
action?: PluginAction
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type GetAIGuardrailsConfigRequest = {
|
|
102
|
+
cluster?: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type UpdateAIGuardrailsConfigRequest = {
|
|
106
|
+
cluster?: string
|
|
107
|
+
config?: AIGuardrailsConfig
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type ListAIGuardrailsConfigRequest = {
|
|
111
|
+
page?: HydraCommonCommon.Pagination
|
|
112
|
+
cluster?: string
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type ListAIGuardrailsConfigResponse = {
|
|
116
|
+
items?: AIGuardrailsConfig[]
|
|
117
|
+
page?: HydraCommonCommon.Pagination
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type QueryAIAuditLogRequest = {
|
|
121
|
+
page?: HydraCommonCommon.Pagination
|
|
122
|
+
startTime?: GoogleProtobufTimestamp.Timestamp
|
|
123
|
+
endTime?: GoogleProtobufTimestamp.Timestamp
|
|
124
|
+
clusterName?: string
|
|
125
|
+
operation?: PluginAction
|
|
126
|
+
pluginId?: GuardrailsPlugin
|
|
127
|
+
level?: GuardrailsLevel
|
|
128
|
+
routeName?: string
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type AIAuditLog = {
|
|
132
|
+
timestamp?: GoogleProtobufTimestamp.Timestamp
|
|
133
|
+
duration?: string
|
|
134
|
+
clusterName?: string
|
|
135
|
+
routeName?: string
|
|
136
|
+
operation?: PluginAction
|
|
137
|
+
pluginId?: GuardrailsPlugin
|
|
138
|
+
level?: GuardrailsLevel
|
|
139
|
+
reason?: string
|
|
140
|
+
denyMessage?: string
|
|
141
|
+
matchSource?: string
|
|
142
|
+
functionName?: string
|
|
143
|
+
functionArgs?: string
|
|
144
|
+
matchRule?: string
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type QueryAIAuditLogResponse = {
|
|
148
|
+
items?: AIAuditLog[]
|
|
149
|
+
page?: HydraCommonCommon.Pagination
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type ExportAIAuditLogRequest = {
|
|
153
|
+
startTime?: GoogleProtobufTimestamp.Timestamp
|
|
154
|
+
endTime?: GoogleProtobufTimestamp.Timestamp
|
|
155
|
+
clusterName?: string
|
|
156
|
+
operation?: PluginAction
|
|
157
|
+
pluginId?: GuardrailsPlugin
|
|
158
|
+
level?: GuardrailsLevel
|
|
159
|
+
exportType?: ExportType
|
|
160
|
+
routeName?: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export class AIGuardrailsService {
|
|
164
|
+
static GetAIGuardrailsConfig(req: GetAIGuardrailsConfigRequest, initReq?: fm.InitReq): Promise<AIGuardrailsConfig> {
|
|
165
|
+
return fm.fetchReq<GetAIGuardrailsConfigRequest, AIGuardrailsConfig>(`/apis/admin.hydra.io/v1alpha1/ai-guardrails/${req["cluster"]}?${fm.renderURLSearchParams(req, ["cluster"])}`, {...initReq, method: "GET"})
|
|
166
|
+
}
|
|
167
|
+
static ListAIGuardrailsConfig(req: ListAIGuardrailsConfigRequest, initReq?: fm.InitReq): Promise<ListAIGuardrailsConfigResponse> {
|
|
168
|
+
return fm.fetchReq<ListAIGuardrailsConfigRequest, ListAIGuardrailsConfigResponse>(`/apis/admin.hydra.io/v1alpha1/ai-guardrails?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
169
|
+
}
|
|
170
|
+
static UpdateAIGuardrailsConfig(req: UpdateAIGuardrailsConfigRequest, initReq?: fm.InitReq): Promise<AIGuardrailsConfig> {
|
|
171
|
+
return fm.fetchReq<UpdateAIGuardrailsConfigRequest, AIGuardrailsConfig>(`/apis/admin.hydra.io/v1alpha1/ai-guardrails`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
172
|
+
}
|
|
173
|
+
static QueryAIAuditLog(req: QueryAIAuditLogRequest, initReq?: fm.InitReq): Promise<QueryAIAuditLogResponse> {
|
|
174
|
+
return fm.fetchReq<QueryAIAuditLogRequest, QueryAIAuditLogResponse>(`/apis/admin.hydra.io/v1alpha1/ai-guardrails-logs?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
175
|
+
}
|
|
176
|
+
static ExportAIAuditLog(req: ExportAIAuditLogRequest, initReq?: fm.InitReq): Promise<GoogleApiHttpbody.HttpBody> {
|
|
177
|
+
return fm.fetchReq<ExportAIAuditLogRequest, GoogleApiHttpbody.HttpBody>(`/apis/admin.hydra.io/v1alpha1/ai-guardrails-logs/export`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -91,6 +91,12 @@ export type UpdateWSAPIKeyQuotaRequest = {
|
|
|
91
91
|
unlimitedQuota?: boolean
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
export type UpdateWSAPIKeyStatusRequest = {
|
|
95
|
+
id?: string
|
|
96
|
+
workspace?: number
|
|
97
|
+
disabled?: boolean
|
|
98
|
+
}
|
|
99
|
+
|
|
94
100
|
export type DeleteAPIKeyRequest = {
|
|
95
101
|
id?: string
|
|
96
102
|
}
|
|
@@ -168,6 +174,9 @@ export class WSAPIKeyManagement {
|
|
|
168
174
|
static DeleteWSAPIKey(req: DeleteWSAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
|
|
169
175
|
return fm.fetchReq<DeleteWSAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
|
|
170
176
|
}
|
|
177
|
+
static UpdateWSAPIKeyStatus(req: UpdateWSAPIKeyStatusRequest, initReq?: fm.InitReq): Promise<APIKey> {
|
|
178
|
+
return fm.fetchReq<UpdateWSAPIKeyStatusRequest, APIKey>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys/${req["id"]}/status`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
179
|
+
}
|
|
171
180
|
static UpdateWSAPIKeyQuota(req: UpdateWSAPIKeyQuotaRequest, initReq?: fm.InitReq): Promise<APIKey> {
|
|
172
181
|
return fm.fetchReq<UpdateWSAPIKeyQuotaRequest, APIKey>(`/apis/hydra.io/v1alpha1/workspaces/${req["workspace"]}/apikeys/${req["id"]}/quota`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
|
|
173
182
|
}
|