@celljs/ai-openai 3.4.4
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/LICENSE +21 -0
- package/README.md +96 -0
- package/lib/common/api/api-protocol.d.ts +47 -0
- package/lib/common/api/api-protocol.d.ts.map +1 -0
- package/lib/common/api/api-protocol.js +6 -0
- package/lib/common/api/api-protocol.js.map +1 -0
- package/lib/common/api/chat-request.d.ts +198 -0
- package/lib/common/api/chat-request.d.ts.map +1 -0
- package/lib/common/api/chat-request.js +145 -0
- package/lib/common/api/chat-request.js.map +1 -0
- package/lib/common/api/chat-response.d.ts +193 -0
- package/lib/common/api/chat-response.d.ts.map +1 -0
- package/lib/common/api/chat-response.js +124 -0
- package/lib/common/api/chat-response.js.map +1 -0
- package/lib/common/api/embeddings-request.d.ts +59 -0
- package/lib/common/api/embeddings-request.d.ts.map +1 -0
- package/lib/common/api/embeddings-request.js +49 -0
- package/lib/common/api/embeddings-request.js.map +1 -0
- package/lib/common/api/embeddings-response.d.ts +27 -0
- package/lib/common/api/embeddings-response.d.ts.map +1 -0
- package/lib/common/api/embeddings-response.js +30 -0
- package/lib/common/api/embeddings-response.js.map +1 -0
- package/lib/common/api/index.d.ts +10 -0
- package/lib/common/api/index.d.ts.map +1 -0
- package/lib/common/api/index.js +13 -0
- package/lib/common/api/index.js.map +1 -0
- package/lib/common/api/message.d.ts +216 -0
- package/lib/common/api/message.d.ts.map +1 -0
- package/lib/common/api/message.js +179 -0
- package/lib/common/api/message.js.map +1 -0
- package/lib/common/api/openai-api.d.ts +18 -0
- package/lib/common/api/openai-api.d.ts.map +1 -0
- package/lib/common/api/openai-api.js +99 -0
- package/lib/common/api/openai-api.js.map +1 -0
- package/lib/common/api/openai-api.spec.d.ts +2 -0
- package/lib/common/api/openai-api.spec.d.ts.map +1 -0
- package/lib/common/api/openai-api.spec.js +162 -0
- package/lib/common/api/openai-api.spec.js.map +1 -0
- package/lib/common/api/openai-model.d.ts +117 -0
- package/lib/common/api/openai-model.d.ts.map +1 -0
- package/lib/common/api/openai-model.js +121 -0
- package/lib/common/api/openai-model.js.map +1 -0
- package/lib/common/api/response-format.d.ts +60 -0
- package/lib/common/api/response-format.d.ts.map +1 -0
- package/lib/common/api/response-format.js +79 -0
- package/lib/common/api/response-format.js.map +1 -0
- package/lib/common/api/usage.d.ts +79 -0
- package/lib/common/api/usage.d.ts.map +1 -0
- package/lib/common/api/usage.js +95 -0
- package/lib/common/api/usage.js.map +1 -0
- package/lib/common/index.d.ts +4 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +7 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/model/index.d.ts +5 -0
- package/lib/common/model/index.d.ts.map +1 -0
- package/lib/common/model/index.js +8 -0
- package/lib/common/model/index.js.map +1 -0
- package/lib/common/model/openai-chat-model.d.ts +37 -0
- package/lib/common/model/openai-chat-model.d.ts.map +1 -0
- package/lib/common/model/openai-chat-model.js +357 -0
- package/lib/common/model/openai-chat-model.js.map +1 -0
- package/lib/common/model/openai-chat-model.spec.d.ts +2 -0
- package/lib/common/model/openai-chat-model.spec.d.ts.map +1 -0
- package/lib/common/model/openai-chat-model.spec.js +82 -0
- package/lib/common/model/openai-chat-model.spec.js.map +1 -0
- package/lib/common/model/openai-chat-options.d.ts +159 -0
- package/lib/common/model/openai-chat-options.d.ts.map +1 -0
- package/lib/common/model/openai-chat-options.js +231 -0
- package/lib/common/model/openai-chat-options.js.map +1 -0
- package/lib/common/model/openai-embedding-model.d.ts +15 -0
- package/lib/common/model/openai-embedding-model.d.ts.map +1 -0
- package/lib/common/model/openai-embedding-model.js +64 -0
- package/lib/common/model/openai-embedding-model.js.map +1 -0
- package/lib/common/model/openai-embedding-model.spec.d.ts +2 -0
- package/lib/common/model/openai-embedding-model.spec.d.ts.map +1 -0
- package/lib/common/model/openai-embedding-model.spec.js +100 -0
- package/lib/common/model/openai-embedding-model.spec.js.map +1 -0
- package/lib/common/model/openai-embedding-options.d.ts +35 -0
- package/lib/common/model/openai-embedding-options.d.ts.map +1 -0
- package/lib/common/model/openai-embedding-options.js +56 -0
- package/lib/common/model/openai-embedding-options.js.map +1 -0
- package/lib/common/module.d.ts +4 -0
- package/lib/common/module.d.ts.map +1 -0
- package/lib/common/module.js +6 -0
- package/lib/common/module.js.map +1 -0
- package/lib/common/support/index.d.ts +3 -0
- package/lib/common/support/index.d.ts.map +1 -0
- package/lib/common/support/index.js +6 -0
- package/lib/common/support/index.js.map +1 -0
- package/lib/common/support/openai-api-response-headers.d.ts +34 -0
- package/lib/common/support/openai-api-response-headers.d.ts.map +1 -0
- package/lib/common/support/openai-api-response-headers.js +45 -0
- package/lib/common/support/openai-api-response-headers.js.map +1 -0
- package/lib/common/support/openai-response-header-extractor.d.ts +12 -0
- package/lib/common/support/openai-response-header-extractor.d.ts.map +1 -0
- package/lib/common/support/openai-response-header-extractor.js +131 -0
- package/lib/common/support/openai-response-header-extractor.js.map +1 -0
- package/lib/common/test/mock-openai-api.d.ts +13 -0
- package/lib/common/test/mock-openai-api.d.ts.map +1 -0
- package/lib/common/test/mock-openai-api.js +57 -0
- package/lib/common/test/mock-openai-api.js.map +1 -0
- package/lib/common/test/test-container.d.ts +3 -0
- package/lib/common/test/test-container.d.ts.map +1 -0
- package/lib/common/test/test-container.js +16 -0
- package/lib/common/test/test-container.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +46 -0
- package/src/common/api/api-protocol.ts +51 -0
- package/src/common/api/chat-request.ts +258 -0
- package/src/common/api/chat-response.ts +218 -0
- package/src/common/api/embeddings-request.ts +92 -0
- package/src/common/api/embeddings-response.ts +44 -0
- package/src/common/api/index.ts +9 -0
- package/src/common/api/message.ts +273 -0
- package/src/common/api/openai-api.spec.ts +175 -0
- package/src/common/api/openai-api.ts +111 -0
- package/src/common/api/openai-model.ts +137 -0
- package/src/common/api/response-format.ts +109 -0
- package/src/common/api/usage.ts +135 -0
- package/src/common/index.ts +3 -0
- package/src/common/model/index.ts +4 -0
- package/src/common/model/openai-chat-model.spec.ts +85 -0
- package/src/common/model/openai-chat-model.ts +399 -0
- package/src/common/model/openai-chat-options.ts +326 -0
- package/src/common/model/openai-embedding-model.spec.ts +112 -0
- package/src/common/model/openai-embedding-model.ts +83 -0
- package/src/common/model/openai-embedding-options.ts +72 -0
- package/src/common/module.ts +4 -0
- package/src/common/support/index.ts +2 -0
- package/src/common/support/openai-api-response-headers.ts +46 -0
- package/src/common/support/openai-response-header-extractor.ts +141 -0
- package/src/common/test/mock-openai-api.ts +70 -0
- package/src/common/test/test-container.ts +13 -0
- package/src/package.spec.ts +4 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
export declare enum ChatCompletionFinishReason {
|
|
2
|
+
/**
|
|
3
|
+
* The model hit a natural stop point or a provided stop sequence.
|
|
4
|
+
*/
|
|
5
|
+
STOP = "stop",
|
|
6
|
+
/**
|
|
7
|
+
* The maximum number of tokens specified in the request was reached.
|
|
8
|
+
*/
|
|
9
|
+
LENGTH = "length",
|
|
10
|
+
/**
|
|
11
|
+
* The content was omitted due to a flag from our content filters.
|
|
12
|
+
*/
|
|
13
|
+
CONTENT_FILTER = "content_filter",
|
|
14
|
+
/**
|
|
15
|
+
* The model called a tool.
|
|
16
|
+
*/
|
|
17
|
+
TOOL_CALLS = "tool_calls",
|
|
18
|
+
/**
|
|
19
|
+
* Only for compatibility with Mistral AI API
|
|
20
|
+
*/
|
|
21
|
+
TOOL_CALL = "tool_call"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The role of the author of this message.
|
|
25
|
+
*/
|
|
26
|
+
export declare enum Role {
|
|
27
|
+
/**
|
|
28
|
+
* System message.
|
|
29
|
+
*/
|
|
30
|
+
SYSTEM = "system",
|
|
31
|
+
/**
|
|
32
|
+
* User message.
|
|
33
|
+
*/
|
|
34
|
+
USER = "user",
|
|
35
|
+
/**
|
|
36
|
+
* Assistant message.
|
|
37
|
+
*/
|
|
38
|
+
ASSISTANT = "assistant",
|
|
39
|
+
/**
|
|
40
|
+
* Tool message.
|
|
41
|
+
*/
|
|
42
|
+
TOOL = "tool"
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The function definition.
|
|
46
|
+
*/
|
|
47
|
+
export declare class ChatCompletionFunction {
|
|
48
|
+
/**
|
|
49
|
+
* The name of the function.
|
|
50
|
+
*/
|
|
51
|
+
name: string;
|
|
52
|
+
/**
|
|
53
|
+
* The arguments that the model expects you to pass to the function.
|
|
54
|
+
*/
|
|
55
|
+
arguments: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The relevant tool call.
|
|
59
|
+
*/
|
|
60
|
+
export declare class ToolCall {
|
|
61
|
+
/**
|
|
62
|
+
* The index of the tool call in the list of tool calls. Required in
|
|
63
|
+
* case of streaming.
|
|
64
|
+
*/
|
|
65
|
+
index?: number;
|
|
66
|
+
/**
|
|
67
|
+
* The ID of the tool call. This ID must be referenced when you submit
|
|
68
|
+
* the tool outputs in using the Submit tool outputs to run endpoint.
|
|
69
|
+
*/
|
|
70
|
+
id: string;
|
|
71
|
+
/**
|
|
72
|
+
* The type of tool call the output is required for. For now, this is
|
|
73
|
+
* always function.
|
|
74
|
+
*/
|
|
75
|
+
type: string;
|
|
76
|
+
/**
|
|
77
|
+
* The function definition.
|
|
78
|
+
*/
|
|
79
|
+
function: ChatCompletionFunction;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Audio response from the model.
|
|
83
|
+
*/
|
|
84
|
+
export declare class AudioOutput {
|
|
85
|
+
/**
|
|
86
|
+
* Unique identifier for the audio response from the model.
|
|
87
|
+
*/
|
|
88
|
+
id?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Audio output from the model.
|
|
91
|
+
*/
|
|
92
|
+
data?: string;
|
|
93
|
+
/**
|
|
94
|
+
* When the audio content will no longer be available on the server.
|
|
95
|
+
*/
|
|
96
|
+
expiresAt?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Transcript of the audio output from the model.
|
|
99
|
+
*/
|
|
100
|
+
transcript?: string;
|
|
101
|
+
static create(id?: string, data?: string, expiresAt?: number, transcript?: string): AudioOutput;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The format of the encoded audio data. Currently supports "wav" and "mp3".
|
|
105
|
+
*/
|
|
106
|
+
export declare enum Format {
|
|
107
|
+
/**
|
|
108
|
+
* MP3 audio format.
|
|
109
|
+
*/
|
|
110
|
+
MP3 = "mp3",
|
|
111
|
+
/**
|
|
112
|
+
* WAV audio format.
|
|
113
|
+
*/
|
|
114
|
+
WAV = "wav"
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Audio input data.
|
|
118
|
+
*/
|
|
119
|
+
export declare class InputAudio {
|
|
120
|
+
/**
|
|
121
|
+
* Base64 encoded audio data.
|
|
122
|
+
*/
|
|
123
|
+
data: string;
|
|
124
|
+
/**
|
|
125
|
+
* The format of the encoded audio data. Currently supports "wav" and "mp3".
|
|
126
|
+
*/
|
|
127
|
+
format: Format;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Image content.
|
|
131
|
+
*/
|
|
132
|
+
export declare class ImageUrl {
|
|
133
|
+
/**
|
|
134
|
+
* Either a URL of the image or the base64 encoded image data. The
|
|
135
|
+
* base64 encoded image data must have a special prefix in the following
|
|
136
|
+
* format: "data:{mimetype};base64,{base64-encoded-image-data}".
|
|
137
|
+
*/
|
|
138
|
+
url: string;
|
|
139
|
+
/**
|
|
140
|
+
* Specifies the detail level of the image.
|
|
141
|
+
*/
|
|
142
|
+
detail?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* An array of content parts with a defined type. Each MediaContent can be of
|
|
146
|
+
* either "text", "image_url", or "input_audio" type. Only one option allowed.
|
|
147
|
+
*/
|
|
148
|
+
export declare class MediaContent {
|
|
149
|
+
/**
|
|
150
|
+
* Content type, each can be of type text or image_url.
|
|
151
|
+
*/
|
|
152
|
+
type: string;
|
|
153
|
+
/**
|
|
154
|
+
* The text content of the message.
|
|
155
|
+
*/
|
|
156
|
+
text: string;
|
|
157
|
+
/**
|
|
158
|
+
* The image content of the message. You can pass multiple images
|
|
159
|
+
* by adding multiple image_url content parts. Image input is only supported when
|
|
160
|
+
* using the gpt-4-visual-preview model.
|
|
161
|
+
*/
|
|
162
|
+
imageUrl: ImageUrl;
|
|
163
|
+
/**
|
|
164
|
+
* Audio content part.
|
|
165
|
+
*/
|
|
166
|
+
inputAudio: InputAudio;
|
|
167
|
+
static createText(text: string): MediaContent;
|
|
168
|
+
static createImageUrl(url: string, detail?: string): MediaContent;
|
|
169
|
+
static createInputAudio(data: string, format: Format): MediaContent;
|
|
170
|
+
}
|
|
171
|
+
export declare class ChatCompletionMessage {
|
|
172
|
+
/**
|
|
173
|
+
* The contents of the message. Can be either a {@link MediaContent}
|
|
174
|
+
* or a {@link String}. The response message content is always a {@link String}.
|
|
175
|
+
*/
|
|
176
|
+
content: any;
|
|
177
|
+
/**
|
|
178
|
+
* The role of the messages author. Could be one of the {@link Role}
|
|
179
|
+
* types.
|
|
180
|
+
*/
|
|
181
|
+
role: Role;
|
|
182
|
+
/**
|
|
183
|
+
* An optional name for the participant. Provides the model information to
|
|
184
|
+
* differentiate between participants of the same role. In case of Function calling,
|
|
185
|
+
* the name is the function name that the message is responding to.
|
|
186
|
+
*/
|
|
187
|
+
name?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Tool call that this message is responding to. Only applicable for
|
|
190
|
+
* the {@link Role#TOOL} role and null otherwise.
|
|
191
|
+
*/
|
|
192
|
+
toolCallId?: string;
|
|
193
|
+
/**
|
|
194
|
+
* The tool calls generated by the model, such as function calls.
|
|
195
|
+
* Applicable only for {@link Role#ASSISTANT} role and null otherwise.
|
|
196
|
+
*/
|
|
197
|
+
toolCalls?: ToolCall[];
|
|
198
|
+
/**
|
|
199
|
+
* The refusal message by the assistant. Applicable only for
|
|
200
|
+
* {@link Role#ASSISTANT} role and null otherwise.
|
|
201
|
+
*/
|
|
202
|
+
refusal?: string;
|
|
203
|
+
/**
|
|
204
|
+
* Audio response from the model.
|
|
205
|
+
*/
|
|
206
|
+
audioOutput?: AudioOutput;
|
|
207
|
+
/**
|
|
208
|
+
* 创建一个新的聊天消息实例。
|
|
209
|
+
*
|
|
210
|
+
* @param text - 消息内容。
|
|
211
|
+
* @param role - 消息角色,表示发送者的身份。
|
|
212
|
+
* @returns 返回一个包含指定内容和角色的 ChatCompletionMessage 实例。
|
|
213
|
+
*/
|
|
214
|
+
static create(text: any, role: Role): ChatCompletionMessage;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/common/api/message.ts"],"names":[],"mappings":"AAEA,oBAAY,0BAA0B;IAClC;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,UAAU,eAAe;IACzB;;OAEG;IACH,SAAS,cAAc;CAC1B;AAED;;GAEG;AACH,oBAAY,IAAI;IACZ;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,IAAI,SAAS;CAChB;AAED;;GAEG;AACH,qBAAa,sBAAsB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,EAAE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;;OAGG;IAEH,OAAO,EAAE,GAAG,CAAC;IACb;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IAEH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IAEH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IAGH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,qBAAqB;CAO9D"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatCompletionMessage = exports.MediaContent = exports.ImageUrl = exports.InputAudio = exports.Format = exports.AudioOutput = exports.ToolCall = exports.ChatCompletionFunction = exports.Role = exports.ChatCompletionFinishReason = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_transformer_1 = require("class-transformer");
|
|
6
|
+
var ChatCompletionFinishReason;
|
|
7
|
+
(function (ChatCompletionFinishReason) {
|
|
8
|
+
/**
|
|
9
|
+
* The model hit a natural stop point or a provided stop sequence.
|
|
10
|
+
*/
|
|
11
|
+
ChatCompletionFinishReason["STOP"] = "stop";
|
|
12
|
+
/**
|
|
13
|
+
* The maximum number of tokens specified in the request was reached.
|
|
14
|
+
*/
|
|
15
|
+
ChatCompletionFinishReason["LENGTH"] = "length";
|
|
16
|
+
/**
|
|
17
|
+
* The content was omitted due to a flag from our content filters.
|
|
18
|
+
*/
|
|
19
|
+
ChatCompletionFinishReason["CONTENT_FILTER"] = "content_filter";
|
|
20
|
+
/**
|
|
21
|
+
* The model called a tool.
|
|
22
|
+
*/
|
|
23
|
+
ChatCompletionFinishReason["TOOL_CALLS"] = "tool_calls";
|
|
24
|
+
/**
|
|
25
|
+
* Only for compatibility with Mistral AI API
|
|
26
|
+
*/
|
|
27
|
+
ChatCompletionFinishReason["TOOL_CALL"] = "tool_call";
|
|
28
|
+
})(ChatCompletionFinishReason = exports.ChatCompletionFinishReason || (exports.ChatCompletionFinishReason = {}));
|
|
29
|
+
/**
|
|
30
|
+
* The role of the author of this message.
|
|
31
|
+
*/
|
|
32
|
+
var Role;
|
|
33
|
+
(function (Role) {
|
|
34
|
+
/**
|
|
35
|
+
* System message.
|
|
36
|
+
*/
|
|
37
|
+
Role["SYSTEM"] = "system";
|
|
38
|
+
/**
|
|
39
|
+
* User message.
|
|
40
|
+
*/
|
|
41
|
+
Role["USER"] = "user";
|
|
42
|
+
/**
|
|
43
|
+
* Assistant message.
|
|
44
|
+
*/
|
|
45
|
+
Role["ASSISTANT"] = "assistant";
|
|
46
|
+
/**
|
|
47
|
+
* Tool message.
|
|
48
|
+
*/
|
|
49
|
+
Role["TOOL"] = "tool";
|
|
50
|
+
})(Role = exports.Role || (exports.Role = {}));
|
|
51
|
+
/**
|
|
52
|
+
* The function definition.
|
|
53
|
+
*/
|
|
54
|
+
class ChatCompletionFunction {
|
|
55
|
+
}
|
|
56
|
+
exports.ChatCompletionFunction = ChatCompletionFunction;
|
|
57
|
+
/**
|
|
58
|
+
* The relevant tool call.
|
|
59
|
+
*/
|
|
60
|
+
class ToolCall {
|
|
61
|
+
}
|
|
62
|
+
exports.ToolCall = ToolCall;
|
|
63
|
+
/**
|
|
64
|
+
* Audio response from the model.
|
|
65
|
+
*/
|
|
66
|
+
class AudioOutput {
|
|
67
|
+
static create(id, data, expiresAt, transcript) {
|
|
68
|
+
const audio = new AudioOutput();
|
|
69
|
+
audio.id = id;
|
|
70
|
+
audio.data = data;
|
|
71
|
+
audio.expiresAt = expiresAt;
|
|
72
|
+
audio.transcript = transcript;
|
|
73
|
+
return audio;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
(0, class_transformer_1.Expose)({ name: 'expires_at' }),
|
|
78
|
+
tslib_1.__metadata("design:type", Number)
|
|
79
|
+
], AudioOutput.prototype, "expiresAt", void 0);
|
|
80
|
+
exports.AudioOutput = AudioOutput;
|
|
81
|
+
/**
|
|
82
|
+
* The format of the encoded audio data. Currently supports "wav" and "mp3".
|
|
83
|
+
*/
|
|
84
|
+
var Format;
|
|
85
|
+
(function (Format) {
|
|
86
|
+
/**
|
|
87
|
+
* MP3 audio format.
|
|
88
|
+
*/
|
|
89
|
+
Format["MP3"] = "mp3";
|
|
90
|
+
/**
|
|
91
|
+
* WAV audio format.
|
|
92
|
+
*/
|
|
93
|
+
Format["WAV"] = "wav";
|
|
94
|
+
})(Format = exports.Format || (exports.Format = {}));
|
|
95
|
+
/**
|
|
96
|
+
* Audio input data.
|
|
97
|
+
*/
|
|
98
|
+
class InputAudio {
|
|
99
|
+
}
|
|
100
|
+
exports.InputAudio = InputAudio;
|
|
101
|
+
/**
|
|
102
|
+
* Image content.
|
|
103
|
+
*/
|
|
104
|
+
class ImageUrl {
|
|
105
|
+
}
|
|
106
|
+
exports.ImageUrl = ImageUrl;
|
|
107
|
+
/**
|
|
108
|
+
* An array of content parts with a defined type. Each MediaContent can be of
|
|
109
|
+
* either "text", "image_url", or "input_audio" type. Only one option allowed.
|
|
110
|
+
*/
|
|
111
|
+
class MediaContent {
|
|
112
|
+
static createText(text) {
|
|
113
|
+
const content = new MediaContent();
|
|
114
|
+
content.type = 'text';
|
|
115
|
+
content.text = text;
|
|
116
|
+
return content;
|
|
117
|
+
}
|
|
118
|
+
static createImageUrl(url, detail) {
|
|
119
|
+
const content = new MediaContent();
|
|
120
|
+
content.type = 'image_url';
|
|
121
|
+
content.imageUrl = new ImageUrl();
|
|
122
|
+
content.imageUrl.url = url;
|
|
123
|
+
content.imageUrl.detail = detail;
|
|
124
|
+
return content;
|
|
125
|
+
}
|
|
126
|
+
static createInputAudio(data, format) {
|
|
127
|
+
const content = new MediaContent();
|
|
128
|
+
content.type = 'input_audio';
|
|
129
|
+
content.inputAudio = new InputAudio();
|
|
130
|
+
content.inputAudio.data = data;
|
|
131
|
+
content.inputAudio.format = format;
|
|
132
|
+
return content;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
tslib_1.__decorate([
|
|
136
|
+
(0, class_transformer_1.Expose)({ name: 'image_url' }),
|
|
137
|
+
(0, class_transformer_1.Type)(() => ImageUrl),
|
|
138
|
+
tslib_1.__metadata("design:type", ImageUrl)
|
|
139
|
+
], MediaContent.prototype, "imageUrl", void 0);
|
|
140
|
+
tslib_1.__decorate([
|
|
141
|
+
(0, class_transformer_1.Expose)({ name: 'input_audio' }),
|
|
142
|
+
(0, class_transformer_1.Type)(() => InputAudio),
|
|
143
|
+
tslib_1.__metadata("design:type", InputAudio)
|
|
144
|
+
], MediaContent.prototype, "inputAudio", void 0);
|
|
145
|
+
exports.MediaContent = MediaContent;
|
|
146
|
+
class ChatCompletionMessage {
|
|
147
|
+
/**
|
|
148
|
+
* 创建一个新的聊天消息实例。
|
|
149
|
+
*
|
|
150
|
+
* @param text - 消息内容。
|
|
151
|
+
* @param role - 消息角色,表示发送者的身份。
|
|
152
|
+
* @returns 返回一个包含指定内容和角色的 ChatCompletionMessage 实例。
|
|
153
|
+
*/
|
|
154
|
+
static create(text, role) {
|
|
155
|
+
const message = new ChatCompletionMessage();
|
|
156
|
+
message.content = text;
|
|
157
|
+
message.role = role;
|
|
158
|
+
return message;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
tslib_1.__decorate([
|
|
162
|
+
(0, class_transformer_1.Expose)({ name: 'content' }),
|
|
163
|
+
tslib_1.__metadata("design:type", Object)
|
|
164
|
+
], ChatCompletionMessage.prototype, "content", void 0);
|
|
165
|
+
tslib_1.__decorate([
|
|
166
|
+
(0, class_transformer_1.Expose)({ name: 'tool_call_id' }),
|
|
167
|
+
tslib_1.__metadata("design:type", String)
|
|
168
|
+
], ChatCompletionMessage.prototype, "toolCallId", void 0);
|
|
169
|
+
tslib_1.__decorate([
|
|
170
|
+
(0, class_transformer_1.Expose)({ name: 'tool_calls' }),
|
|
171
|
+
tslib_1.__metadata("design:type", Array)
|
|
172
|
+
], ChatCompletionMessage.prototype, "toolCalls", void 0);
|
|
173
|
+
tslib_1.__decorate([
|
|
174
|
+
(0, class_transformer_1.Expose)({ name: 'audio' }),
|
|
175
|
+
(0, class_transformer_1.Type)(() => AudioOutput),
|
|
176
|
+
tslib_1.__metadata("design:type", AudioOutput)
|
|
177
|
+
], ChatCompletionMessage.prototype, "audioOutput", void 0);
|
|
178
|
+
exports.ChatCompletionMessage = ChatCompletionMessage;
|
|
179
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/common/api/message.ts"],"names":[],"mappings":";;;;AAAA,yDAAiD;AAEjD,IAAY,0BAqBX;AArBD,WAAY,0BAA0B;IAClC;;OAEG;IACH,2CAAa,CAAA;IACb;;OAEG;IACH,+CAAiB,CAAA;IACjB;;OAEG;IACH,+DAAiC,CAAA;IACjC;;OAEG;IACH,uDAAyB,CAAA;IACzB;;OAEG;IACH,qDAAuB,CAAA;AAC3B,CAAC,EArBW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAqBrC;AAED;;GAEG;AACH,IAAY,IAiBX;AAjBD,WAAY,IAAI;IACZ;;OAEG;IACH,yBAAiB,CAAA;IACjB;;OAEG;IACH,qBAAa,CAAA;IACb;;OAEG;IACH,+BAAuB,CAAA;IACvB;;OAEG;IACH,qBAAa,CAAA;AACjB,CAAC,EAjBW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAiBf;AAED;;GAEG;AACH,MAAa,sBAAsB;CASlC;AATD,wDASC;AAED;;GAEG;AACH,MAAa,QAAQ;CAoBpB;AApBD,4BAoBC;AAED;;GAEG;AACH,MAAa,WAAW;IAmBpB,MAAM,CAAC,MA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AAA,wBAAI,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC;sCACV,WAAW;0DAAC;AAxC9B,sDAwDC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ResponseEntity, RestOperations } from '@celljs/http';
|
|
3
|
+
import { ChatCompletionRequest } from './chat-request';
|
|
4
|
+
import { EmbeddingRequest } from './embeddings-request';
|
|
5
|
+
import { EmbeddingResponse } from './embeddings-response';
|
|
6
|
+
import { ChatCompletion, ChatCompletionChunk } from './chat-response';
|
|
7
|
+
import { OpenAIAPI, OpenAIAPIOptions } from './api-protocol';
|
|
8
|
+
export declare class OpenAIAPIImpl implements OpenAIAPI {
|
|
9
|
+
protected readonly restOperations: RestOperations;
|
|
10
|
+
protected readonly apiOptions: OpenAIAPIOptions;
|
|
11
|
+
protected readonly apiOptions2: OpenAIAPIOptions;
|
|
12
|
+
protected finalApiOptions: Required<OpenAIAPIOptions>;
|
|
13
|
+
protected init(): void;
|
|
14
|
+
chat(chatRequest: ChatCompletionRequest, additionalHttpHeader?: Record<string, string>): Promise<ResponseEntity<ChatCompletion>>;
|
|
15
|
+
streamingChat(chatRequest: ChatCompletionRequest, additionalHttpHeader?: Record<string, string>): Promise<Observable<ResponseEntity<ChatCompletionChunk>>>;
|
|
16
|
+
embed<T>(embeddingRequest: EmbeddingRequest<T>): Promise<ResponseEntity<EmbeddingResponse>>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=openai-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai-api.d.ts","sourceRoot":"","sources":["../../../src/common/api/openai-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAA0B,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAI7D,qBACa,aAAc,YAAW,SAAS;IAG3C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IAIhD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAEjD,SAAS,CAAC,eAAe,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAGtD,SAAS,CAAC,IAAI;IAUR,IAAI,CAAC,WAAW,EAAE,qBAAqB,EAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAmBhI,aAAa,CAAC,WAAW,EAAE,qBAAqB,EAAE,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC;IA0B1J,KAAK,CAAC,CAAC,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;CA2BpG"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAIAPIImpl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@celljs/core");
|
|
6
|
+
const operators_1 = require("rxjs/operators");
|
|
7
|
+
const http_1 = require("@celljs/http");
|
|
8
|
+
const embeddings_response_1 = require("./embeddings-response");
|
|
9
|
+
const chat_response_1 = require("./chat-response");
|
|
10
|
+
const api_protocol_1 = require("./api-protocol");
|
|
11
|
+
const class_transformer_1 = require("class-transformer");
|
|
12
|
+
const ai_core_1 = require("@celljs/ai-core");
|
|
13
|
+
let OpenAIAPIImpl = class OpenAIAPIImpl {
|
|
14
|
+
init() {
|
|
15
|
+
this.finalApiOptions = {
|
|
16
|
+
baseUrl: 'https://api.openai.com',
|
|
17
|
+
completionsPath: '/v1/chat/completions',
|
|
18
|
+
embeddingsPath: '/v1/embeddings',
|
|
19
|
+
...this.apiOptions,
|
|
20
|
+
...this.apiOptions2
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async chat(chatRequest, additionalHttpHeader) {
|
|
24
|
+
core_1.Assert.isTrue(!chatRequest.stream, 'Request must set the stream property to false.');
|
|
25
|
+
const { data, status, headers } = await this.restOperations
|
|
26
|
+
.post(this.finalApiOptions.completionsPath, (0, class_transformer_1.instanceToPlain)(chatRequest), {
|
|
27
|
+
baseURL: this.finalApiOptions.baseUrl,
|
|
28
|
+
headers: additionalHttpHeader
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
status,
|
|
32
|
+
headers,
|
|
33
|
+
body: (0, class_transformer_1.plainToInstance)(chat_response_1.ChatCompletion, data)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async streamingChat(chatRequest, additionalHttpHeader) {
|
|
37
|
+
core_1.Assert.isTrue(!!chatRequest.stream, 'Request must set the stream property to true.');
|
|
38
|
+
const { data, status, headers } = await this.restOperations
|
|
39
|
+
.post(this.finalApiOptions.completionsPath, (0, class_transformer_1.instanceToPlain)(chatRequest), {
|
|
40
|
+
baseURL: this.finalApiOptions.baseUrl,
|
|
41
|
+
headers: {
|
|
42
|
+
[http_1.HttpHeaders.ACCEPT]: http_1.MediaType.TEXT_EVENT_STREAM,
|
|
43
|
+
...additionalHttpHeader
|
|
44
|
+
},
|
|
45
|
+
responseType: 'stream'
|
|
46
|
+
});
|
|
47
|
+
return ai_core_1.SSEUtil.toObservable(data).pipe((0, operators_1.map)(item => ({
|
|
48
|
+
status,
|
|
49
|
+
headers,
|
|
50
|
+
body: (0, class_transformer_1.plainToInstance)(chat_response_1.ChatCompletionChunk, item.data)
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
async embed(embeddingRequest) {
|
|
54
|
+
// Input text to embed, encoded as a string or array of tokens. To embed multiple
|
|
55
|
+
// inputs in a single
|
|
56
|
+
// request, pass an array of strings or array of token arrays.
|
|
57
|
+
core_1.Assert.notNull(embeddingRequest.input, 'The input can not be null.');
|
|
58
|
+
core_1.Assert.isTrue(typeof embeddingRequest.input === 'string' || Array.isArray(embeddingRequest.input), 'The input must be either a String, or a List of Strings or List of List of integers.');
|
|
59
|
+
// The input must not exceed the max input tokens for the model (8192 tokens for
|
|
60
|
+
// text-embedding-ada-002), cannot
|
|
61
|
+
// be an empty string, and any array must be 2048 dimensions or less.
|
|
62
|
+
if (Array.isArray(embeddingRequest.input)) {
|
|
63
|
+
core_1.Assert.isTrue(embeddingRequest.input.length > 0, 'The input list can not be empty.');
|
|
64
|
+
core_1.Assert.isTrue(embeddingRequest.input.length <= 2048, 'The list must be 2048 dimensions or less');
|
|
65
|
+
core_1.Assert.isTrue(typeof embeddingRequest.input[0] === 'string' || typeof embeddingRequest.input[0] === 'number' || Array.isArray(embeddingRequest.input[0]), 'The input must be either a String, or a List of Strings or list of list of integers.');
|
|
66
|
+
}
|
|
67
|
+
const { data, status, headers } = await this.restOperations
|
|
68
|
+
.post(this.finalApiOptions.embeddingsPath, (0, class_transformer_1.instanceToPlain)(embeddingRequest), { baseURL: this.finalApiOptions.baseUrl });
|
|
69
|
+
return {
|
|
70
|
+
status,
|
|
71
|
+
headers,
|
|
72
|
+
body: (0, class_transformer_1.plainToInstance)(embeddings_response_1.EmbeddingResponse, data)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
(0, core_1.Autowired)(http_1.RestOperations),
|
|
78
|
+
tslib_1.__metadata("design:type", Function)
|
|
79
|
+
], OpenAIAPIImpl.prototype, "restOperations", void 0);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, core_1.Value)('cell.ai.openai.api'),
|
|
82
|
+
tslib_1.__metadata("design:type", Object)
|
|
83
|
+
], OpenAIAPIImpl.prototype, "apiOptions", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, core_1.Autowired)(api_protocol_1.OpenAIAPIOptions),
|
|
86
|
+
(0, core_1.Optional)(),
|
|
87
|
+
tslib_1.__metadata("design:type", Object)
|
|
88
|
+
], OpenAIAPIImpl.prototype, "apiOptions2", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, core_1.PostConstruct)(),
|
|
91
|
+
tslib_1.__metadata("design:type", Function),
|
|
92
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
93
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
94
|
+
], OpenAIAPIImpl.prototype, "init", null);
|
|
95
|
+
OpenAIAPIImpl = tslib_1.__decorate([
|
|
96
|
+
(0, core_1.Component)(api_protocol_1.OpenAIAPI)
|
|
97
|
+
], OpenAIAPIImpl);
|
|
98
|
+
exports.OpenAIAPIImpl = OpenAIAPIImpl;
|
|
99
|
+
//# sourceMappingURL=openai-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai-api.js","sourceRoot":"","sources":["../../../src/common/api/openai-api.ts"],"names":[],"mappings":";;;;AAAA,uCAA4F;AAE5F,8CAAqC;AACrC,uCAAsF;AAGtF,+DAA0D;AAC1D,mDAAsE;AACtE,iDAA6D;AAC7D,yDAAqE;AACrE,6CAA0C;AAGnC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAeZ,IAAI;QACV,IAAI,CAAC,eAAe,GAAG;YACnB,OAAO,EAAE,wBAAwB;YACjC,eAA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