@lemoncloud/eureka-agents-api 0.26.108
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/README.md +3 -0
- package/dist/cores/types.d.ts +219 -0
- package/dist/lib/gemini/types.d.ts +57 -0
- package/dist/lib/openai/types.d.ts +91 -0
- package/dist/lib/types.d.ts +176 -0
- package/dist/modules/agents/model.d.ts +602 -0
- package/dist/modules/agents/types.d.ts +578 -0
- package/dist/modules/agents/views.d.ts +208 -0
- package/dist/modules/callback/types.d.ts +55 -0
- package/dist/modules/mock/model.d.ts +100 -0
- package/dist/modules/mock/types.d.ts +42 -0
- package/dist/modules/mock/views.d.ts +49 -0
- package/dist/service/backend-types.d.ts +58 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/view/types.d.ts +13 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `types.ts`
|
|
3
|
+
* - common types used in `/cores`
|
|
4
|
+
*
|
|
5
|
+
* @author Steve <steve@lemoncloud.io>
|
|
6
|
+
* @date 2022-06-21 optimized w/ `abstract-services`
|
|
7
|
+
* @date 2022-06-28 added `Codable` interface for general types.
|
|
8
|
+
* @date 2023-01-18 optimized with `lemon-core@3.2.4`
|
|
9
|
+
* @date 2023-02-15 optimized with `lemon-core@3.2.5`
|
|
10
|
+
* @date 2024-11-14 optimized `IdentityToken`.
|
|
11
|
+
*
|
|
12
|
+
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
13
|
+
* @origin `@lemoncloud/lemon-templates-api/cores`
|
|
14
|
+
*/
|
|
15
|
+
import { NextIdentity, CoreModel, View, Body } from 'lemon-model';
|
|
16
|
+
export { CoreModel, View, Body };
|
|
17
|
+
/** type: `IdentityTokenSite` */
|
|
18
|
+
export interface IdentityTokenSite {
|
|
19
|
+
/** site-code (ex: kwonsun) */
|
|
20
|
+
code?: string;
|
|
21
|
+
/** name of site (ex: 권선) */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** stereo of site (ex: enterprise) */
|
|
24
|
+
stereo?: string;
|
|
25
|
+
}
|
|
26
|
+
/** type: `IdentityTokenUser` */
|
|
27
|
+
export interface IdentityTokenUser {
|
|
28
|
+
/** name of user (ex: 홍길동) */
|
|
29
|
+
name?: string;
|
|
30
|
+
/** nick of user (ex: 홍사마) */
|
|
31
|
+
nick?: string;
|
|
32
|
+
/** (optional) login-id of user */
|
|
33
|
+
login?: string;
|
|
34
|
+
/** (optional) email of user */
|
|
35
|
+
email?: string;
|
|
36
|
+
}
|
|
37
|
+
/** type: `IdentityTokenGroup` */
|
|
38
|
+
export interface IdentityTokenGroup {
|
|
39
|
+
/** site-code (ex: kwonsun) */
|
|
40
|
+
code?: string;
|
|
41
|
+
/** name of site (ex: 권선) */
|
|
42
|
+
name?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* type: `IdentityToken` (named as `session`)
|
|
46
|
+
* - 계정토큰(= JWT(IdentityToken))으로, `/refresh`시 AWS Key와 함께 발급됨 (기본, 1일동안 유효함)
|
|
47
|
+
* - `backend-api`에서 조직/그룹/사용자에 맞게 재설정됨!
|
|
48
|
+
* - 세션토큰 검사는 `proxy.getCurrentSession()` 이용하기
|
|
49
|
+
*/
|
|
50
|
+
export interface IdentityToken<T = any, U extends IdentityTokenUser = IdentityTokenUser, S extends IdentityTokenSite = IdentityTokenSite, G extends IdentityTokenGroup = IdentityTokenGroup> extends NextIdentity<T> {
|
|
51
|
+
/**
|
|
52
|
+
* site-id (= id in `SiteModel(사이트)`)
|
|
53
|
+
* - `#` 일경우, 특정 site에 엮이지 않음 (무시됨)
|
|
54
|
+
* - `0000` 일경우, 기본 site 정보로 환경설정에 따름
|
|
55
|
+
* - 메인 `backend-api` (see `.iss`)에서 관리되는 `site-model`의 id
|
|
56
|
+
*
|
|
57
|
+
* @see SiteModel
|
|
58
|
+
*/
|
|
59
|
+
sid: string;
|
|
60
|
+
/**
|
|
61
|
+
* group-id (= id in `GroupModel(그룹)`)
|
|
62
|
+
* - `group`은 `user`를 물리적 구분으로 나눠서 생각해볼때 이용가능함.
|
|
63
|
+
*
|
|
64
|
+
* @see GroupModel
|
|
65
|
+
*/
|
|
66
|
+
gid: string;
|
|
67
|
+
/**
|
|
68
|
+
* user-id (= id in `UserModel(유저)`)
|
|
69
|
+
* - 메인 `backend-api` (see `.iss`)에서 관리되는 `user-model`의 id.
|
|
70
|
+
*
|
|
71
|
+
* @see UserModel
|
|
72
|
+
*/
|
|
73
|
+
uid: string;
|
|
74
|
+
/**
|
|
75
|
+
* auth-id (= id in `AuthModel(인정정보)`)
|
|
76
|
+
* - 메인 `backend-api` (see `.iss`)에서 관리되는 `auth-model`의 id.
|
|
77
|
+
* - 인증 정보를 통해서, 로그인의 추가 상세 정보를 알 수 있음.
|
|
78
|
+
*
|
|
79
|
+
* @see AuthModel
|
|
80
|
+
*/
|
|
81
|
+
aid: string;
|
|
82
|
+
/**
|
|
83
|
+
* list of roles (like `user`, `admin`, `super`)
|
|
84
|
+
*/
|
|
85
|
+
roles: string[];
|
|
86
|
+
/**
|
|
87
|
+
* (optional) internal `identity-id` (= delegated identity)
|
|
88
|
+
* - `.identityId` 는 aws cognito 인증을 통해서, 현재 인증된 `identity-id`를 알 수 있음
|
|
89
|
+
* - 다만, `delegated`된 경우에는 위임된 id 가 들어감.
|
|
90
|
+
*
|
|
91
|
+
* @deprecated 삭제될 예정! @241114
|
|
92
|
+
*/
|
|
93
|
+
iid?: string;
|
|
94
|
+
/**
|
|
95
|
+
* service-name of issuer
|
|
96
|
+
* ex) `lemon-backend-api`
|
|
97
|
+
*/
|
|
98
|
+
iss?: string;
|
|
99
|
+
/** Site Info */
|
|
100
|
+
Site: S;
|
|
101
|
+
/** User Info */
|
|
102
|
+
User: U;
|
|
103
|
+
/** (optional) Group Info */
|
|
104
|
+
Group?: G;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* type `ListResult`
|
|
108
|
+
*/
|
|
109
|
+
export interface ListResult<T, R = any> {
|
|
110
|
+
/**
|
|
111
|
+
* total searched count
|
|
112
|
+
*/
|
|
113
|
+
total?: number;
|
|
114
|
+
/**
|
|
115
|
+
* max items count in the page
|
|
116
|
+
*/
|
|
117
|
+
limit?: number;
|
|
118
|
+
/**
|
|
119
|
+
* current page number.
|
|
120
|
+
*/
|
|
121
|
+
page?: number;
|
|
122
|
+
/**
|
|
123
|
+
* (optional) time took in sec
|
|
124
|
+
*/
|
|
125
|
+
took?: number;
|
|
126
|
+
/**
|
|
127
|
+
* items searched
|
|
128
|
+
*/
|
|
129
|
+
list: T[];
|
|
130
|
+
/**
|
|
131
|
+
* (optional) aggr list
|
|
132
|
+
*/
|
|
133
|
+
aggr?: R[];
|
|
134
|
+
}
|
|
135
|
+
export interface AggrKeyCount {
|
|
136
|
+
/** name of key(or bucket name) */
|
|
137
|
+
key: string;
|
|
138
|
+
/** number of count */
|
|
139
|
+
val: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* type `PaginatedListResult`
|
|
143
|
+
*/
|
|
144
|
+
export interface PaginatedListResult<T, R = string> extends ListResult<T, R> {
|
|
145
|
+
/**
|
|
146
|
+
* current page
|
|
147
|
+
*/
|
|
148
|
+
page: number;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* type `ListParam`
|
|
152
|
+
*/
|
|
153
|
+
export interface ListParam {
|
|
154
|
+
/**
|
|
155
|
+
* max items count to be fetched
|
|
156
|
+
*/
|
|
157
|
+
limit?: number;
|
|
158
|
+
/**
|
|
159
|
+
* (optional) sorting order
|
|
160
|
+
* - 'asc': older first
|
|
161
|
+
* - 'desc': newer first
|
|
162
|
+
* - string: extended sorting features
|
|
163
|
+
*/
|
|
164
|
+
sort?: 'asc' | 'desc' | string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* type `PaginateParam`
|
|
168
|
+
*/
|
|
169
|
+
export interface PaginateParam extends ListParam {
|
|
170
|
+
/**
|
|
171
|
+
* page # to fetch (0-indexed)
|
|
172
|
+
*/
|
|
173
|
+
page?: number;
|
|
174
|
+
/**
|
|
175
|
+
* (optional) offset # from start.
|
|
176
|
+
*/
|
|
177
|
+
offset?: number;
|
|
178
|
+
/**
|
|
179
|
+
* (optional) flag to filter by uid
|
|
180
|
+
*/
|
|
181
|
+
uid?: string;
|
|
182
|
+
/**
|
|
183
|
+
* (optional) flag to filter by sid (only for admin role)
|
|
184
|
+
*/
|
|
185
|
+
sid?: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* type `BulkUpdateBody`
|
|
189
|
+
*/
|
|
190
|
+
export interface BulkUpdateBody<T> extends BulkBody<T> {
|
|
191
|
+
/**
|
|
192
|
+
* list bulk update model with id
|
|
193
|
+
*/
|
|
194
|
+
list: T[];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* body data for bulk
|
|
198
|
+
*/
|
|
199
|
+
export interface BulkBody<T> {
|
|
200
|
+
list: T[];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* list of the selected model-id
|
|
204
|
+
*/
|
|
205
|
+
export interface BodyList<T extends {
|
|
206
|
+
id: string;
|
|
207
|
+
} = {
|
|
208
|
+
id: string;
|
|
209
|
+
}> {
|
|
210
|
+
list: T[];
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* type `BulkItemsResult`
|
|
214
|
+
*/
|
|
215
|
+
export interface BulkItemsResult {
|
|
216
|
+
success: number;
|
|
217
|
+
failed: number;
|
|
218
|
+
failedItems: any[];
|
|
219
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `gemini-types.ts`
|
|
3
|
+
* - common types definitions for gemini service
|
|
4
|
+
*
|
|
5
|
+
* @author Steve <steve@lemoncloud.io>
|
|
6
|
+
* @date 2025-11-19 initial version.
|
|
7
|
+
* @date 2025-11-29 refactoring manager as singleton pattern
|
|
8
|
+
*
|
|
9
|
+
* @copyright (C) lemoncloud.io 2025 - All Rights Reserved.
|
|
10
|
+
*/
|
|
11
|
+
import { GenAIManagerOptions } from '../types';
|
|
12
|
+
/**
|
|
13
|
+
* type: `GEMINI_LUT`
|
|
14
|
+
*/
|
|
15
|
+
export declare const $LUT_GEMINI: {
|
|
16
|
+
/** type: EncodingFormat */
|
|
17
|
+
EncodingFormat: {
|
|
18
|
+
float: string;
|
|
19
|
+
base64: string;
|
|
20
|
+
};
|
|
21
|
+
/** type: GenRoleType */
|
|
22
|
+
GenRoleType: {
|
|
23
|
+
system: string;
|
|
24
|
+
user: string;
|
|
25
|
+
assistant: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* as `GenModelType`
|
|
29
|
+
*/
|
|
30
|
+
GenModelType: {
|
|
31
|
+
'gemini-2.5-flash': string;
|
|
32
|
+
'gemini-3-pro-image-preview': string;
|
|
33
|
+
'gemini-3.5-pro': string;
|
|
34
|
+
'gemini-4-pro': string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* type: `EncodingFormat`
|
|
39
|
+
*/
|
|
40
|
+
export declare type EncodingFormat = keyof typeof $LUT_GEMINI.EncodingFormat;
|
|
41
|
+
/**
|
|
42
|
+
* type: `GenRoleType`
|
|
43
|
+
*/
|
|
44
|
+
export declare type GenRoleType = keyof typeof $LUT_GEMINI.GenRoleType;
|
|
45
|
+
/**
|
|
46
|
+
* type: `GenModelType`
|
|
47
|
+
*/
|
|
48
|
+
export declare type GenModelType = keyof typeof $LUT_GEMINI.GenModelType;
|
|
49
|
+
/**
|
|
50
|
+
* type: `GeminiManagerOptions`
|
|
51
|
+
*/
|
|
52
|
+
export interface GeminiManagerOptions extends GenAIManagerOptions {
|
|
53
|
+
/** file (yml) to save the raw response */
|
|
54
|
+
ymlFile?: string;
|
|
55
|
+
/** flag to use template (default `true`) */
|
|
56
|
+
template?: boolean;
|
|
57
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `openai-types.ts`
|
|
3
|
+
* - common types definitions for openai service
|
|
4
|
+
*
|
|
5
|
+
* @author Steve <steve@lemoncloud.io>
|
|
6
|
+
* @date 2025-11-19 initial version.
|
|
7
|
+
* @date 2025-11-29 refactoring manager as singleton pattern
|
|
8
|
+
*
|
|
9
|
+
* @copyright (C) lemoncloud.io 2025 - All Rights Reserved.
|
|
10
|
+
*/
|
|
11
|
+
import { GenAIManagerOptions } from '../types';
|
|
12
|
+
/**
|
|
13
|
+
* type: `OPENAI_LUT`
|
|
14
|
+
*/
|
|
15
|
+
export declare const $LUT_OPENAI: {
|
|
16
|
+
/** type: EncodingFormat */
|
|
17
|
+
EncodingFormat: {
|
|
18
|
+
float: string;
|
|
19
|
+
base64: string;
|
|
20
|
+
};
|
|
21
|
+
/** type: GenRoleType */
|
|
22
|
+
GenRoleType: {
|
|
23
|
+
system: string;
|
|
24
|
+
user: string;
|
|
25
|
+
assistant: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* as `GenModelType`
|
|
29
|
+
*/
|
|
30
|
+
GenModelType: {
|
|
31
|
+
'gpt-4o': string;
|
|
32
|
+
'gpt-4o-mini': string;
|
|
33
|
+
'gpt-4-turbo': string;
|
|
34
|
+
'gpt-4': string;
|
|
35
|
+
'gpt-4.1': string;
|
|
36
|
+
'gpt-5': string;
|
|
37
|
+
'gpt-5-mini': string;
|
|
38
|
+
'gpt-5.1': string;
|
|
39
|
+
'gpt-3.5-turbo': string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* type: `EncodingFormat`
|
|
44
|
+
*/
|
|
45
|
+
export declare type EncodingFormat = keyof typeof $LUT_OPENAI.EncodingFormat;
|
|
46
|
+
/**
|
|
47
|
+
* type: `GenRoleType`
|
|
48
|
+
*/
|
|
49
|
+
export declare type GenRoleType = keyof typeof $LUT_OPENAI.GenRoleType;
|
|
50
|
+
/**
|
|
51
|
+
* type: `GenModelType`
|
|
52
|
+
*/
|
|
53
|
+
export declare type GenModelType = keyof typeof $LUT_OPENAI.GenModelType;
|
|
54
|
+
/**
|
|
55
|
+
* type: `OpenAIManagerOptions`
|
|
56
|
+
*/
|
|
57
|
+
export interface OpenAIManagerOptions extends GenAIManagerOptions {
|
|
58
|
+
/** flag to save the raw response (default `false`) */
|
|
59
|
+
isSave?: boolean;
|
|
60
|
+
/** file (yml) to save the raw response */
|
|
61
|
+
ymlFile?: string;
|
|
62
|
+
/** flag to use template (default `true`) */
|
|
63
|
+
template?: boolean;
|
|
64
|
+
/** consumer to handle each streaming token */
|
|
65
|
+
consumer?: (token: string) => Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* type: `TextEmbeddingOption`
|
|
69
|
+
*/
|
|
70
|
+
export interface TextEmbeddingOption {
|
|
71
|
+
/**
|
|
72
|
+
* text embedding model
|
|
73
|
+
* - default is `'text-embedding-3-large'`
|
|
74
|
+
*/
|
|
75
|
+
embeddingModel?: 'text-embedding-ada-002' | 'text-embedding-3-small' | 'text-embedding-3-large' | string;
|
|
76
|
+
/**
|
|
77
|
+
* encoding format of embedding
|
|
78
|
+
* - default is 'float'
|
|
79
|
+
*/
|
|
80
|
+
encodingFormat?: 'float' | 'base64';
|
|
81
|
+
/**
|
|
82
|
+
* vector dimensions
|
|
83
|
+
* - default is 1536
|
|
84
|
+
*/
|
|
85
|
+
dimensions?: number;
|
|
86
|
+
/**
|
|
87
|
+
* input
|
|
88
|
+
* - text or array of texts to be embedded
|
|
89
|
+
*/
|
|
90
|
+
input?: string | string[];
|
|
91
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `lib/types.ts`
|
|
3
|
+
* - contains only the hyper types.
|
|
4
|
+
* - `publish types` 할때, lemon-core 포함을 최소화하기 위한 조치!
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @author Steve <steve@lemoncloud.io>
|
|
8
|
+
* @date 2022-10-18 initial version
|
|
9
|
+
*
|
|
10
|
+
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
11
|
+
*/
|
|
12
|
+
export * as gemini from './gemini/types';
|
|
13
|
+
export * as openai from './openai/types';
|
|
14
|
+
/**
|
|
15
|
+
* interface: `GenAIAgentCommon`
|
|
16
|
+
* - common interface for GenAI agent managers
|
|
17
|
+
*/
|
|
18
|
+
export interface GenAIAgentCommon<
|
|
19
|
+
/** generative LLM model */
|
|
20
|
+
GenModel extends string = string,
|
|
21
|
+
/** possible content type */
|
|
22
|
+
ContType = string,
|
|
23
|
+
/** options for the manager */
|
|
24
|
+
Options extends GenAIManagerOptions = GenAIManagerOptions> {
|
|
25
|
+
/** get the type of the agent (ex: gemini) */
|
|
26
|
+
type(): string;
|
|
27
|
+
/** say hello from agent */
|
|
28
|
+
hello?(): string;
|
|
29
|
+
/** type check of ChatModelType */
|
|
30
|
+
asChatModelType(model: string): GenModel;
|
|
31
|
+
/** load request from sample files */
|
|
32
|
+
loadSampleRequest(file: string, options?: {
|
|
33
|
+
path?: string;
|
|
34
|
+
}): Promise<GenAIRequest<ContType>>;
|
|
35
|
+
/** convert body to GenAIParams<GenModelType> */
|
|
36
|
+
asGenAIParams(body: GenAIRequestBody<ContType>): GenAIParams<GenModel>;
|
|
37
|
+
/** convert body to GenAIRequest<T> */
|
|
38
|
+
asGenAIRequest(body: GenAIRequestBody<ContType> | GenAIRequest<ContType>): GenAIRequest<ContType>;
|
|
39
|
+
/**
|
|
40
|
+
* generate a response
|
|
41
|
+
*
|
|
42
|
+
* @param params the generation parameters
|
|
43
|
+
* @param request the generation request
|
|
44
|
+
* @param options the generation options
|
|
45
|
+
* @returns the generation response
|
|
46
|
+
*/
|
|
47
|
+
generate(params: GenAIParams<GenModel>, request: GenAIRequest<ContType>, options?: Options): Promise<GenAIResponse<ContType>>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* type: `GenAIManagerOptions`
|
|
51
|
+
* - options for GenAI manager
|
|
52
|
+
*/
|
|
53
|
+
export interface GenAIManagerOptions {
|
|
54
|
+
/** flag to save the raw response (default `false`) */
|
|
55
|
+
isSave?: boolean;
|
|
56
|
+
/** consumer to handle each streaming token */
|
|
57
|
+
consumer?: (token: string) => Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* type: `GenAIParams`
|
|
61
|
+
* - parameter for GenAI execution
|
|
62
|
+
*/
|
|
63
|
+
export interface GenAIParams<GenModel extends string = string> {
|
|
64
|
+
/** llm model to use */
|
|
65
|
+
model: GenModel;
|
|
66
|
+
/**
|
|
67
|
+
* (optional) temperature
|
|
68
|
+
* - a number between 0 and 2, where lower values make the output more focused and deterministic,
|
|
69
|
+
* while higher values make it more random and creative.
|
|
70
|
+
* - default is 1.0
|
|
71
|
+
* - if not set, the default value of the model will be used.
|
|
72
|
+
*/
|
|
73
|
+
temperature?: number;
|
|
74
|
+
/**
|
|
75
|
+
* (optional) topP
|
|
76
|
+
* - an alternative to sampling with temperature, called nucleus sampling,
|
|
77
|
+
* where the model considers the results of the tokens with top P probability mass.
|
|
78
|
+
* - default is 1.0
|
|
79
|
+
* - if not set, the default value of the model will be used.
|
|
80
|
+
*/
|
|
81
|
+
topP?: number;
|
|
82
|
+
/**
|
|
83
|
+
* (internal) flag in mockup mode
|
|
84
|
+
* - if input is like `#1`, then it will be in mockup mode.
|
|
85
|
+
*/
|
|
86
|
+
isMocks?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* type: `GenAIRequest`
|
|
90
|
+
* - request for GenAI service
|
|
91
|
+
*/
|
|
92
|
+
export interface GenAIRequest<ContType = string> {
|
|
93
|
+
/** system prompt */
|
|
94
|
+
system?: GenAIContent<ContType>;
|
|
95
|
+
/** user input prompt */
|
|
96
|
+
prompt?: GenAIContent<ContType>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* the type of `GenAIContent` without `contents`.
|
|
100
|
+
*/
|
|
101
|
+
export interface GenAIContent<ContType = string> {
|
|
102
|
+
/** (internal) id of content */
|
|
103
|
+
id?: string;
|
|
104
|
+
/** (internal) type of content */
|
|
105
|
+
type?: string;
|
|
106
|
+
/** (internal) stereo in type */
|
|
107
|
+
stereo?: string;
|
|
108
|
+
/** content */
|
|
109
|
+
content: ContType;
|
|
110
|
+
/** (optional) embedding vector if stereo=embedding */
|
|
111
|
+
vector?: number[];
|
|
112
|
+
/** (optional) embedding dimensions */
|
|
113
|
+
dimension?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* type: `GenAIContent`
|
|
117
|
+
* - response for GenAI service
|
|
118
|
+
*/
|
|
119
|
+
export interface GenAIResponse<ContType = string> {
|
|
120
|
+
/** (optional) original parameter */
|
|
121
|
+
$param?: GenAIParams;
|
|
122
|
+
/** output prompt (or answer) */
|
|
123
|
+
output: GenAIContent<ContType>;
|
|
124
|
+
/** usage token in detail */
|
|
125
|
+
usage?: TokenUsageDetail;
|
|
126
|
+
/** the 1st candidate response (if any) */
|
|
127
|
+
candidate?: any;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* type: `TokenUsageResponse`
|
|
131
|
+
*/
|
|
132
|
+
export interface TokenUsageDetail {
|
|
133
|
+
/** prompt token */
|
|
134
|
+
promptToken?: number;
|
|
135
|
+
/** completion token */
|
|
136
|
+
completionToken?: number;
|
|
137
|
+
/** total token */
|
|
138
|
+
totalToken?: number;
|
|
139
|
+
/** image token */
|
|
140
|
+
imageToken?: number;
|
|
141
|
+
/** embedding token */
|
|
142
|
+
embeddingToken?: number;
|
|
143
|
+
/** vision token */
|
|
144
|
+
visionToken?: number;
|
|
145
|
+
/** classification token */
|
|
146
|
+
classificationToken?: number;
|
|
147
|
+
/** search token */
|
|
148
|
+
searchToken?: number;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* type: `GenAIRequestBody`
|
|
152
|
+
* - request body for GenAI service
|
|
153
|
+
*/
|
|
154
|
+
export interface GenAIRequestBody<ContType = string> {
|
|
155
|
+
/** system prompt */
|
|
156
|
+
system?: GenAIContent<ContType> | string;
|
|
157
|
+
/** user input prompt */
|
|
158
|
+
prompt?: GenAIContent<ContType> | string;
|
|
159
|
+
/** (optional) input string if no prompt is provided */
|
|
160
|
+
input?: string;
|
|
161
|
+
/**
|
|
162
|
+
* (optional) model to use
|
|
163
|
+
*/
|
|
164
|
+
model?: string;
|
|
165
|
+
/** (optional) temperature */
|
|
166
|
+
temperature?: string | number;
|
|
167
|
+
/** (optional) topP */
|
|
168
|
+
topP?: string | number;
|
|
169
|
+
/** (optional) additional configuration per agent */
|
|
170
|
+
config?: object;
|
|
171
|
+
/**
|
|
172
|
+
* (optional) websocket connection id
|
|
173
|
+
* - if provided, the response will be sent via websocket
|
|
174
|
+
*/
|
|
175
|
+
connectionId?: string;
|
|
176
|
+
}
|