@daocloud-proto/hydra 0.18.0-dev-11 → 0.18.0-dev-12
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.
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import * as HydraCommonCommon from "../../../common/common.pb"
|
|
8
8
|
import * as fm from "../../../fetch.pb"
|
|
9
|
-
import * as GoogleApiHttpbody from "../../../google/api/httpbody.pb"
|
|
10
9
|
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
11
10
|
|
|
12
11
|
type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
|
|
@@ -281,7 +280,7 @@ export class AIGuardrailsService {
|
|
|
281
280
|
static QueryAIAuditLogStatistics(req: QueryAIAuditLogStatisticsRequest, initReq?: fm.InitReq): Promise<QueryAIAuditLogStatisticsResponse> {
|
|
282
281
|
return fm.fetchReq<QueryAIAuditLogStatisticsRequest, QueryAIAuditLogStatisticsResponse>(`/apis/admin.hydra.io/v1alpha1/ai-guardrails-logs/statistics?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
283
282
|
}
|
|
284
|
-
static ExportAIAuditLog(req: ExportAIAuditLogRequest, initReq?: fm.InitReq): Promise<
|
|
285
|
-
return fm.
|
|
283
|
+
static ExportAIAuditLog(req: ExportAIAuditLogRequest, initReq?: fm.InitReq): Promise<Response> {
|
|
284
|
+
return fm.fetchRawReq(`/apis/admin.hydra.io/v1alpha1/ai-guardrails-logs/export?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
286
285
|
}
|
|
287
286
|
}
|
package/fetch.pb.ts
CHANGED
|
@@ -338,4 +338,21 @@ export function renderURLSearchParams<T extends RequestPayload>(
|
|
|
338
338
|
);
|
|
339
339
|
|
|
340
340
|
return new URLSearchParams(urlSearchParams).toString();
|
|
341
|
-
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export async function fetchRawReq(path: string, init?: InitReq): Promise<Response> {
|
|
344
|
+
const {pathPrefix, ...req} = init || {}
|
|
345
|
+
const url = pathPrefix ? `${pathPrefix}${path}` : path
|
|
346
|
+
const response = await fetch(url, req)
|
|
347
|
+
if (!response.ok) {
|
|
348
|
+
const text = await response.text()
|
|
349
|
+
let body: unknown = text
|
|
350
|
+
try {
|
|
351
|
+
body = JSON.parse(text)
|
|
352
|
+
} catch {
|
|
353
|
+
// Preserve a non-JSON error body when an intermediary does not use the gateway error schema.
|
|
354
|
+
}
|
|
355
|
+
throw body
|
|
356
|
+
}
|
|
357
|
+
return response
|
|
358
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
|
+
|
|
11
|
+
export enum ModelUsageExportFormat {
|
|
12
|
+
MODEL_USAGE_EXPORT_FORMAT_UNSPECIFIED = "MODEL_USAGE_EXPORT_FORMAT_UNSPECIFIED",
|
|
13
|
+
MODEL_USAGE_EXPORT_FORMAT_CSV = "MODEL_USAGE_EXPORT_FORMAT_CSV",
|
|
14
|
+
MODEL_USAGE_EXPORT_FORMAT_EXCEL = "MODEL_USAGE_EXPORT_FORMAT_EXCEL",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type ExportModelUsageRequest = {
|
|
18
|
+
startTime?: GoogleProtobufTimestamp.Timestamp
|
|
19
|
+
endTime?: GoogleProtobufTimestamp.Timestamp
|
|
20
|
+
apiKeyIds?: string[]
|
|
21
|
+
models?: string[]
|
|
22
|
+
userId?: string
|
|
23
|
+
responseCodes?: string[]
|
|
24
|
+
format?: ModelUsageExportFormat
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ListModelUsageRequest = {
|
|
28
|
+
startTime?: GoogleProtobufTimestamp.Timestamp
|
|
29
|
+
endTime?: GoogleProtobufTimestamp.Timestamp
|
|
30
|
+
apiKeyIds?: string[]
|
|
31
|
+
models?: string[]
|
|
32
|
+
userId?: string
|
|
33
|
+
page?: HydraCommonCommon.Pagination
|
|
34
|
+
responseCodes?: string[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type ModelUsageItem = {
|
|
38
|
+
requestTime?: GoogleProtobufTimestamp.Timestamp
|
|
39
|
+
requestId?: string
|
|
40
|
+
model?: string
|
|
41
|
+
apiKeyNameOrId?: string
|
|
42
|
+
statusCode?: string
|
|
43
|
+
totalTokens?: string
|
|
44
|
+
inputTokens?: string
|
|
45
|
+
outputTokens?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ModelUsageColumn = {
|
|
49
|
+
field?: string
|
|
50
|
+
title?: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ListModelUsageResponse = {
|
|
54
|
+
items?: ModelUsageItem[]
|
|
55
|
+
page?: HydraCommonCommon.Pagination
|
|
56
|
+
columns?: ModelUsageColumn[]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class ModelUsageService {
|
|
60
|
+
static ListModelUsage(req: ListModelUsageRequest, initReq?: fm.InitReq): Promise<ListModelUsageResponse> {
|
|
61
|
+
return fm.fetchReq<ListModelUsageRequest, ListModelUsageResponse>(`/apis/hydra.io/v1alpha1/model-usage?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
62
|
+
}
|
|
63
|
+
static ExportModelUsage(req: ExportModelUsageRequest, initReq?: fm.InitReq): Promise<Response> {
|
|
64
|
+
return fm.fetchRawReq(`/apis/hydra.io/v1alpha1/model-usage/export?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
|
|
65
|
+
}
|
|
66
|
+
}
|