web-llm-runner 0.1.1
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 +211 -0
- package/README.md +564 -0
- package/lib/cache_util.d.ts +19 -0
- package/lib/cache_util.d.ts.map +1 -0
- package/lib/config.d.ts +199 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/conversation.d.ts +107 -0
- package/lib/conversation.d.ts.map +1 -0
- package/lib/embedding.d.ts +38 -0
- package/lib/embedding.d.ts.map +1 -0
- package/lib/engine.d.ts +140 -0
- package/lib/engine.d.ts.map +1 -0
- package/lib/error.d.ts +208 -0
- package/lib/error.d.ts.map +1 -0
- package/lib/extension_service_worker.d.ts +54 -0
- package/lib/extension_service_worker.d.ts.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +13767 -0
- package/lib/index.js.map +1 -0
- package/lib/integrity.d.ts +44 -0
- package/lib/integrity.d.ts.map +1 -0
- package/lib/llm_chat.d.ts +258 -0
- package/lib/llm_chat.d.ts.map +1 -0
- package/lib/message.d.ts +87 -0
- package/lib/message.d.ts.map +1 -0
- package/lib/openai_api_protocols/chat_completion.d.ts +834 -0
- package/lib/openai_api_protocols/chat_completion.d.ts.map +1 -0
- package/lib/openai_api_protocols/completion.d.ts +270 -0
- package/lib/openai_api_protocols/completion.d.ts.map +1 -0
- package/lib/openai_api_protocols/embedding.d.ts +125 -0
- package/lib/openai_api_protocols/embedding.d.ts.map +1 -0
- package/lib/openai_api_protocols/index.d.ts +20 -0
- package/lib/openai_api_protocols/index.d.ts.map +1 -0
- package/lib/service_worker.d.ts +53 -0
- package/lib/service_worker.d.ts.map +1 -0
- package/lib/support.d.ts +117 -0
- package/lib/support.d.ts.map +1 -0
- package/lib/types.d.ts +202 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/utils.d.ts +7 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/web_worker.d.ts +132 -0
- package/lib/web_worker.d.ts.map +1 -0
- package/lib/wrapper/WebLLMWrapper.d.ts +20 -0
- package/lib/wrapper/WebLLMWrapper.d.ts.map +1 -0
- package/lib/wrapper/llm-worker.d.ts +2 -0
- package/lib/wrapper/llm-worker.d.ts.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat_completion.d.ts","sourceRoot":"","sources":["../../src/openai_api_protocols/chat_completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAGL,SAAS,EACV,MAAM,WAAW,CAAC;AAuBnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAI9D,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAqB;IACnC,WAAW,EAAE,WAAW,CAAC;gBAEb,MAAM,EAAE,kBAAkB;CAIvC;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,EAAE,kBAAkB;IAItC,MAAM,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,cAAc,CAAC;IAC3E,MAAM,CACJ,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC9C,MAAM,CACJ,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,GAAG,cAAc,CAAC;CAMhE;AAID;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAE5C;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAEpD;;OAEG;IACH,CAAC,CAAC,EAAE,MAA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AC,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACpC;QAED,UAAiB,KAAK,CAAC;YACrB,UAAiB,QAAQ;gBACvB;;mBAEG;gBACH,KAAK,EAAE,MAAM,CAAC;gBAEd;;mBAEG;gBACH,EAAE,CAAC,EAAE,MAAM,CAAC;gBAEZ,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;gBAE7B;;mBAEG;gBACH,IAAI,CAAC,EAAE,UAAU,CAAC;aACnB;YAED,UAAiB,QAAQ,CAAC;gBACxB,UAAiB,QAAQ;oBACvB;;;;;uBAKG;oBACH,SAAS,CAAC,EAAE,MAAM,CAAC;oBAEnB;;uBAEG;oBACH,IAAI,CAAC,EAAE,MAAM,CAAC;iBACf;aACF;SACF;QAED;;WAEG;QACH,UAAiB,QAAQ;YACvB;;eAEG;YACH,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,GAAG,IAAI,CAAC;SACnD;KACF;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,GAAG,gBAAgB,CAAC;IAC7D;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;CAC7C"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input to OpenAI API, directly adopted from openai-node with small tweaks:
|
|
3
|
+
* https://github.com/openai/openai-node/blob/master/src/resources/completions.ts
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 OpenAI
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { MLCEngineInterface } from "../types";
|
|
18
|
+
import { ChatCompletion, ChatCompletionStreamOptions, CompletionUsage, ChatCompletionFinishReason } from "./chat_completion";
|
|
19
|
+
export declare class Completions {
|
|
20
|
+
private engine;
|
|
21
|
+
constructor(engine: MLCEngineInterface);
|
|
22
|
+
create(request: CompletionCreateParamsNonStreaming): Promise<Completion>;
|
|
23
|
+
create(request: CompletionCreateParamsStreaming): Promise<AsyncIterable<Completion>>;
|
|
24
|
+
create(request: CompletionCreateParamsBase): Promise<AsyncIterable<Completion> | Completion>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* OpenAI completion request protocol.
|
|
28
|
+
*
|
|
29
|
+
* API reference: https://platform.openai.com/docs/api-reference/completions/create
|
|
30
|
+
* Followed: https://github.com/openai/openai-node/blob/master/src/resources/completions.ts
|
|
31
|
+
*
|
|
32
|
+
* @note `model` is excluded. Instead, call `CreateMLCEngine(model)` or `engine.reload(model)` explicitly before calling this API.
|
|
33
|
+
*/
|
|
34
|
+
export interface CompletionCreateParamsBase {
|
|
35
|
+
/**
|
|
36
|
+
* The prompt(s) to generate completions for, encoded as a string.
|
|
37
|
+
*/
|
|
38
|
+
prompt: string;
|
|
39
|
+
/**
|
|
40
|
+
* Echo back the prompt in addition to the completion
|
|
41
|
+
*/
|
|
42
|
+
echo?: boolean | null;
|
|
43
|
+
/**
|
|
44
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
|
45
|
+
* existing frequency in the text so far, decreasing the model's likelihood to
|
|
46
|
+
* repeat the same line verbatim.
|
|
47
|
+
*
|
|
48
|
+
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
|
|
49
|
+
*/
|
|
50
|
+
frequency_penalty?: number | null;
|
|
51
|
+
/**
|
|
52
|
+
* Modify the likelihood of specified tokens appearing in the completion.
|
|
53
|
+
*
|
|
54
|
+
* Accepts a JSON object that maps tokens (specified by their token ID, which varies per model)
|
|
55
|
+
* to an associated bias value from -100 to 100. Typically, you can see `tokenizer.json` of the
|
|
56
|
+
* model to see which token ID maps to what string. Mathematically, the bias is added to the
|
|
57
|
+
* logits generated by the model prior to sampling. The exact effect will vary per model, but
|
|
58
|
+
* values between -1 and 1 should decrease or increase likelihood of selection; values like -100
|
|
59
|
+
* or 100 should result in a ban or exclusive selection of the relevant token.
|
|
60
|
+
*
|
|
61
|
+
* As an example, you can pass `{"16230": -100}` to prevent the `Hello` token from being
|
|
62
|
+
* generated in Mistral-7B-Instruct-v0.2, according to the mapping in
|
|
63
|
+
* https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/raw/main/tokenizer.json.
|
|
64
|
+
*
|
|
65
|
+
* @note For stateful and customizable / flexible logit processing, see `webllm.LogitProcessor`.
|
|
66
|
+
* @note If used in combination with `webllm.LogitProcessor`, `logit_bias` is applied after
|
|
67
|
+
* `LogitProcessor.processLogits()` is called.
|
|
68
|
+
*/
|
|
69
|
+
logit_bias?: Record<string, number> | null;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to return log probabilities of the output tokens or not.
|
|
72
|
+
*
|
|
73
|
+
* If true, returns the log probabilities of each output token returned in the `content` of
|
|
74
|
+
* `message`.
|
|
75
|
+
*/
|
|
76
|
+
logprobs?: boolean | null;
|
|
77
|
+
/**
|
|
78
|
+
* An integer between 0 and 5 specifying the number of most likely tokens to return
|
|
79
|
+
* at each token position, each with an associated log probability. `logprobs` must
|
|
80
|
+
* be set to `true` if this parameter is used.
|
|
81
|
+
*/
|
|
82
|
+
top_logprobs?: number | null;
|
|
83
|
+
/**
|
|
84
|
+
* The maximum number of [tokens](/tokenizer) that can be generated in the
|
|
85
|
+
* completion.
|
|
86
|
+
*
|
|
87
|
+
* The total length of input tokens and generated tokens is limited by the model's
|
|
88
|
+
* context length.
|
|
89
|
+
*/
|
|
90
|
+
max_tokens?: number | null;
|
|
91
|
+
/**
|
|
92
|
+
* How many completions to generate for each prompt.
|
|
93
|
+
*/
|
|
94
|
+
n?: number | null;
|
|
95
|
+
/**
|
|
96
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
|
97
|
+
* whether they appear in the text so far, increasing the model's likelihood to
|
|
98
|
+
* talk about new topics.
|
|
99
|
+
*
|
|
100
|
+
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
|
|
101
|
+
*/
|
|
102
|
+
presence_penalty?: number | null;
|
|
103
|
+
/**
|
|
104
|
+
* Penalizes new tokens based on whether they appear in the prompt and the
|
|
105
|
+
* generated text so far. Values greater than 1.0 encourage the model to use new
|
|
106
|
+
* tokens, while values less than 1.0 encourage the model to repeat tokens.
|
|
107
|
+
*/
|
|
108
|
+
repetition_penalty?: number | null;
|
|
109
|
+
/**
|
|
110
|
+
* If specified, our system will make a best effort to sample deterministically,
|
|
111
|
+
* such that repeated requests with the same `seed` and parameters should return
|
|
112
|
+
* the same result.
|
|
113
|
+
*
|
|
114
|
+
* @note Seeding is done on a request-level rather than choice-level. That is, if `n > 1`, you
|
|
115
|
+
* would still get different content for each `Choice`. But if two requests with `n = 2` are
|
|
116
|
+
* processed with the same seed, the two results should be the same (two choices are different).
|
|
117
|
+
*/
|
|
118
|
+
seed?: number | null;
|
|
119
|
+
/**
|
|
120
|
+
* Up to 4 sequences where the API will stop generating further tokens. The
|
|
121
|
+
* returned text will not contain the stop sequence.
|
|
122
|
+
*/
|
|
123
|
+
stop?: string | null | Array<string>;
|
|
124
|
+
/**
|
|
125
|
+
* If set, partial deltas will be sent. It will be terminated by an empty chunk.
|
|
126
|
+
*/
|
|
127
|
+
stream?: boolean | null;
|
|
128
|
+
/**
|
|
129
|
+
* Options for streaming response. Only set this when you set `stream: true`.
|
|
130
|
+
*/
|
|
131
|
+
stream_options?: ChatCompletionStreamOptions | null;
|
|
132
|
+
/**
|
|
133
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
134
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
135
|
+
* focused and deterministic.
|
|
136
|
+
*
|
|
137
|
+
* We generally recommend altering this or `top_p` but not both.
|
|
138
|
+
*/
|
|
139
|
+
temperature?: number | null;
|
|
140
|
+
/**
|
|
141
|
+
* An alternative to sampling with temperature, called nucleus sampling, where the
|
|
142
|
+
* model considers the results of the tokens with top_p probability mass. So 0.1
|
|
143
|
+
* means only the tokens comprising the top 10% probability mass are considered.
|
|
144
|
+
*
|
|
145
|
+
* We generally recommend altering this or `temperature` but not both.
|
|
146
|
+
*/
|
|
147
|
+
top_p?: number | null;
|
|
148
|
+
/**
|
|
149
|
+
* If true, will ignore stop string and stop token and generate until max_tokens hit.
|
|
150
|
+
* If unset, will treat as false.
|
|
151
|
+
*/
|
|
152
|
+
ignore_eos?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* ID of the model to use. This equals to `ModelRecord.model_id`, which needs to either be in
|
|
155
|
+
* `webllm.prebuiltAppConfig` or in `engineConfig.appConfig`.
|
|
156
|
+
*
|
|
157
|
+
* @note Call `CreateMLCEngine(model)` or `engine.reload(model)` ahead of time.
|
|
158
|
+
* @note If only one model is loaded in the engine, this field is optional. If multiple models
|
|
159
|
+
* are loaded, this is required.
|
|
160
|
+
*/
|
|
161
|
+
model?: string | null;
|
|
162
|
+
/**
|
|
163
|
+
* The suffix that comes after a completion of inserted text.
|
|
164
|
+
*
|
|
165
|
+
* @note This field is not supported.
|
|
166
|
+
*/
|
|
167
|
+
suffix?: string | null;
|
|
168
|
+
/**
|
|
169
|
+
* A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
170
|
+
* and detect abuse.
|
|
171
|
+
*
|
|
172
|
+
* @note This field is not supported.
|
|
173
|
+
*/
|
|
174
|
+
user?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Generates `best_of` completions server-side and returns the "best" (the one with
|
|
177
|
+
* the highest log probability per token). Results cannot be streamed.
|
|
178
|
+
*
|
|
179
|
+
* When used with `n`, `best_of` controls the number of candidate completions and
|
|
180
|
+
* `n` specifies how many to return – `best_of` must be greater than `n`.
|
|
181
|
+
*
|
|
182
|
+
* @note This field is not supported.
|
|
183
|
+
*/
|
|
184
|
+
best_of?: number | null;
|
|
185
|
+
/**
|
|
186
|
+
* Fields specific to WebLLM, not present in OpenAI.
|
|
187
|
+
*/
|
|
188
|
+
extra_body?: {
|
|
189
|
+
/**
|
|
190
|
+
* If set to true, the response will include a breakdown of the time spent in various
|
|
191
|
+
* stages of token sampling.
|
|
192
|
+
*/
|
|
193
|
+
enable_latency_breakdown?: boolean | null;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
|
197
|
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
198
|
+
/**
|
|
199
|
+
* If set, partial deltas will be sent. It will be terminated by an empty chunk.
|
|
200
|
+
*/
|
|
201
|
+
stream?: false | null;
|
|
202
|
+
}
|
|
203
|
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
204
|
+
/**
|
|
205
|
+
* If set, partial deltas will be sent. It will be terminated by an empty chunk.
|
|
206
|
+
*/
|
|
207
|
+
stream: true;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Represents a completion response returned by model, based on the provided input.
|
|
211
|
+
*/
|
|
212
|
+
export interface Completion {
|
|
213
|
+
/**
|
|
214
|
+
* A unique identifier for the completion.
|
|
215
|
+
*/
|
|
216
|
+
id: string;
|
|
217
|
+
/**
|
|
218
|
+
* The list of completion choices the model generated for the input prompt.
|
|
219
|
+
*/
|
|
220
|
+
choices: Array<CompletionChoice>;
|
|
221
|
+
/**
|
|
222
|
+
* The Unix timestamp (in seconds) of when the completion was created.
|
|
223
|
+
*/
|
|
224
|
+
created: number;
|
|
225
|
+
/**
|
|
226
|
+
* The model used for completion.
|
|
227
|
+
*/
|
|
228
|
+
model: string;
|
|
229
|
+
/**
|
|
230
|
+
* The object type, which is always "text_completion"
|
|
231
|
+
*/
|
|
232
|
+
object: "text_completion";
|
|
233
|
+
/**
|
|
234
|
+
* This fingerprint represents the backend configuration that the model runs with.
|
|
235
|
+
*
|
|
236
|
+
* Can be used in conjunction with the `seed` request parameter to understand when
|
|
237
|
+
* backend changes have been made that might impact determinism.
|
|
238
|
+
*
|
|
239
|
+
* @note Not supported yet.
|
|
240
|
+
*/
|
|
241
|
+
system_fingerprint?: string;
|
|
242
|
+
/**
|
|
243
|
+
* Usage statistics for the completion request.
|
|
244
|
+
*/
|
|
245
|
+
usage?: CompletionUsage;
|
|
246
|
+
}
|
|
247
|
+
export interface CompletionChoice {
|
|
248
|
+
/**
|
|
249
|
+
* The reason the model stopped generating tokens. This will be `stop` if the model
|
|
250
|
+
* hit a natural stop point or a provided stop sequence, or `length` if the maximum
|
|
251
|
+
* number of tokens specified in the request was reached.
|
|
252
|
+
*/
|
|
253
|
+
finish_reason: ChatCompletionFinishReason | null;
|
|
254
|
+
index: number;
|
|
255
|
+
/**
|
|
256
|
+
* A list of message content tokens with log probability information.
|
|
257
|
+
* @note Different from openai-node, we reuse ChatCompletion's Logprobs.
|
|
258
|
+
*/
|
|
259
|
+
logprobs?: ChatCompletion.Choice.Logprobs | null;
|
|
260
|
+
text: string;
|
|
261
|
+
}
|
|
262
|
+
export declare const CompletionCreateParamsUnsupportedFields: Array<string>;
|
|
263
|
+
/**
|
|
264
|
+
* Post init and verify whether the input of the request is valid. Thus, this function can throw
|
|
265
|
+
* error or in-place update request.
|
|
266
|
+
* @param request User's input request.
|
|
267
|
+
* @param currentModelId The current model loaded that will perform this request.
|
|
268
|
+
*/
|
|
269
|
+
export declare function postInitAndCheckFields(request: CompletionCreateParams, currentModelId: string): void;
|
|
270
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/openai_api_protocols/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAO9C,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,eAAe,EACf,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,EAAE,kBAAkB;IAItC,MAAM,CAAC,OAAO,EAAE,kCAAkC,GAAG,OAAO,CAAC,UAAU,CAAC;IACxE,MAAM,CACJ,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,CACJ,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;CAMnD;AAGD;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAE3C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAA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+BACf,SAAQ,0BAA0B;IAClC;;OAEG;IACH,MAAM,EAAE,IAAI,CAAC;CACd;AAGD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEjC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAC;IAE1B;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAEjD,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;IAEjD,IAAI,EAAE,MAAM,CAAC;CACd;AAID,eAAO,MAAM,uCAAuC,EAAE,KAAK,CAAC,MAAM,CAIjE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,sBAAsB,EAE/B,cAAc,EAAE,MAAM,GACrB,IAAI,CA8BN"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input to OpenAI API, directly adopted from openai-node with small tweaks:
|
|
3
|
+
* https://github.com/openai/openai-node/blob/master/src/resources/embeddings.ts
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 OpenAI
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { MLCEngineInterface } from "../types";
|
|
18
|
+
export declare class Embeddings {
|
|
19
|
+
private engine;
|
|
20
|
+
constructor(engine: MLCEngineInterface);
|
|
21
|
+
/**
|
|
22
|
+
* Creates an embedding vector representing the input text.
|
|
23
|
+
*/
|
|
24
|
+
create(request: EmbeddingCreateParams): Promise<CreateEmbeddingResponse>;
|
|
25
|
+
}
|
|
26
|
+
export interface CreateEmbeddingResponse {
|
|
27
|
+
/**
|
|
28
|
+
* The list of embeddings generated by the model.
|
|
29
|
+
*/
|
|
30
|
+
data: Array<Embedding>;
|
|
31
|
+
/**
|
|
32
|
+
* The name of the model used to generate the embedding.
|
|
33
|
+
*/
|
|
34
|
+
model: string;
|
|
35
|
+
/**
|
|
36
|
+
* The object type, which is always "list".
|
|
37
|
+
*/
|
|
38
|
+
object: "list";
|
|
39
|
+
/**
|
|
40
|
+
* The usage information for the request.
|
|
41
|
+
*/
|
|
42
|
+
usage: CreateEmbeddingResponse.Usage;
|
|
43
|
+
}
|
|
44
|
+
export declare namespace CreateEmbeddingResponse {
|
|
45
|
+
/**
|
|
46
|
+
* The usage information for the request.
|
|
47
|
+
*/
|
|
48
|
+
interface Usage {
|
|
49
|
+
/**
|
|
50
|
+
* The number of tokens used by the prompt.
|
|
51
|
+
*/
|
|
52
|
+
prompt_tokens: number;
|
|
53
|
+
/**
|
|
54
|
+
* The total number of tokens used by the request.
|
|
55
|
+
*/
|
|
56
|
+
total_tokens: number;
|
|
57
|
+
/**
|
|
58
|
+
* Fields specific to WebLLM, not present in OpenAI.
|
|
59
|
+
*/
|
|
60
|
+
extra: {
|
|
61
|
+
/**
|
|
62
|
+
* Number of tokens per second for prefilling.
|
|
63
|
+
*/
|
|
64
|
+
prefill_tokens_per_s: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Represents an embedding vector returned by embedding endpoint.
|
|
70
|
+
*/
|
|
71
|
+
export interface Embedding {
|
|
72
|
+
/**
|
|
73
|
+
* The embedding vector, which is a list of floats. The length of vector depends on
|
|
74
|
+
* the model.
|
|
75
|
+
*/
|
|
76
|
+
embedding: Array<number>;
|
|
77
|
+
/**
|
|
78
|
+
* The index of the embedding in the list of embeddings.
|
|
79
|
+
*/
|
|
80
|
+
index: number;
|
|
81
|
+
/**
|
|
82
|
+
* The object type, which is always "embedding".
|
|
83
|
+
*/
|
|
84
|
+
object: "embedding";
|
|
85
|
+
}
|
|
86
|
+
export interface EmbeddingCreateParams {
|
|
87
|
+
/**
|
|
88
|
+
* Input text to embed, encoded as a string or array of tokens. To embed multiple
|
|
89
|
+
* inputs in a single request, pass an array of strings or array of token arrays.
|
|
90
|
+
* The input must not exceed the max input tokens for the model, and cannot be an empty string.
|
|
91
|
+
* If the batch size is too large, multiple forward of the will take place.
|
|
92
|
+
*/
|
|
93
|
+
input: string | Array<string> | Array<number> | Array<Array<number>>;
|
|
94
|
+
/**
|
|
95
|
+
* ID of the model to use. This equals to `ModelRecord.model_id`, which needs to either be in
|
|
96
|
+
* `webllm.prebuiltAppConfig` or in `engineConfig.appConfig`.
|
|
97
|
+
*
|
|
98
|
+
* @note Call `CreateMLCEngine(model)` or `engine.reload(model)` ahead of time.
|
|
99
|
+
* @note If only one model is loaded in the engine, this field is optional. If multiple models
|
|
100
|
+
* are loaded, this is required.
|
|
101
|
+
*/
|
|
102
|
+
model?: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* The format to return the embeddings in.
|
|
105
|
+
*
|
|
106
|
+
* @note Currently only support `float`.
|
|
107
|
+
*/
|
|
108
|
+
encoding_format?: "float" | "base64";
|
|
109
|
+
/**
|
|
110
|
+
* The number of dimensions the resulting output embeddings should have.
|
|
111
|
+
*
|
|
112
|
+
* @note Not supported.
|
|
113
|
+
*/
|
|
114
|
+
dimensions?: number;
|
|
115
|
+
/**
|
|
116
|
+
* A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
117
|
+
* and detect abuse.
|
|
118
|
+
*
|
|
119
|
+
* @note Not supported.
|
|
120
|
+
*/
|
|
121
|
+
user?: string;
|
|
122
|
+
}
|
|
123
|
+
export declare const EmbeddingCreateParamsUnsupportedFields: Array<string>;
|
|
124
|
+
export declare function postInitAndCheckFields(request: EmbeddingCreateParams, currentModelId: string): void;
|
|
125
|
+
//# sourceMappingURL=embedding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/openai_api_protocols/embedding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,EAAE,kBAAkB;IAItC;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAGzE;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAEvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC;CACtC;AAGD,yBAAiB,uBAAuB,CAAC;IACvC;;OAEG;IACH,UAAiB,KAAK;QACpB;;WAEG;QACH,aAAa,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,YAAY,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,KAAK,EAAE;YACL;;eAEG;YACH,oBAAoB,EAAE,MAAM,CAAC;SAC9B,CAAC;KACH;CACF;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAErE;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAGrC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,sCAAsC,EAAE,KAAK,CAAC,MAAM,CAGhE,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,qBAAqB,EAE9B,cAAc,EAAE,MAAM,GACrB,IAAI,CAmCN"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input to OpenAI API, directly adopted from openai-node with small tweaks:
|
|
3
|
+
* https://github.com/openai/openai-node/blob/master/src/resources/chat/completions.ts
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 OpenAI
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { Chat, ChatCompletionRequestBase, ChatCompletionRequestNonStreaming, ChatCompletionRequestStreaming, ChatCompletionRequest, ChatCompletion, ChatCompletionChunk, ChatCompletionRequestUnsupportedFields, postInitAndCheckFields as postInitAndCheckFieldsChatCompletion, ChatCompletionContentPart, ChatCompletionContentPartText, ChatCompletionContentPartImage, ChatCompletionMessageToolCall, ChatCompletionRole, ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam, ChatCompletionToolMessageParam, ChatCompletionMessageParam, FunctionParameters, FunctionDefinition, ChatCompletionTool, ChatCompletionNamedToolChoice, ChatCompletionToolChoiceOption, TopLogprob, ChatCompletionTokenLogprob, ChatCompletionMessage, CompletionUsage, ResponseFormat, ChatCompletionFinishReason, } from "./chat_completion";
|
|
18
|
+
export { Completions, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, CompletionCreateParamsBase, CompletionCreateParams, Completion, CompletionChoice, postInitAndCheckFields as postInitAndCheckFieldsCompletion, } from "./completion";
|
|
19
|
+
export { Embeddings, Embedding, EmbeddingCreateParams, CreateEmbeddingResponse, postInitAndCheckFields as postInitAndCheckFieldsEmbedding, } from "./embedding";
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/openai_api_protocols/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,IAAI,EACJ,yBAAyB,EACzB,iCAAiC,EACjC,8BAA8B,EAC9B,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,sCAAsC,EACtC,sBAAsB,IAAI,oCAAoC,EAC9D,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,kBAAkB,EAClB,gCAAgC,EAChC,8BAA8B,EAC9B,mCAAmC,EACnC,8BAA8B,EAC9B,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,6BAA6B,EAC7B,8BAA8B,EAC9B,UAAU,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,kCAAkC,EAClC,+BAA+B,EAC/B,0BAA0B,EAC1B,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,sBAAsB,IAAI,gCAAgC,GAC3D,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,IAAI,+BAA+B,GAC1D,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ChatOptions, MLCEngineConfig } from "./config";
|
|
2
|
+
import { WorkerRequest, WorkerResponse } from "./message";
|
|
3
|
+
import { WebWorkerMLCEngineHandler, WebWorkerMLCEngine, ChatWorker } from "./web_worker";
|
|
4
|
+
/**
|
|
5
|
+
* Worker handler that can be used in a ServiceWorker.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* const engine = new MLCEngine();
|
|
10
|
+
* let handler;
|
|
11
|
+
* chrome.runtime.onConnect.addListener(function (port) {
|
|
12
|
+
* if (handler === undefined) {
|
|
13
|
+
* handler = new ServiceWorkerMLCEngineHandler(engine, port);
|
|
14
|
+
* } else {
|
|
15
|
+
* handler.setPort(port);
|
|
16
|
+
* }
|
|
17
|
+
* port.onMessage.addListener(handler.onmessage.bind(handler));
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
export declare class ServiceWorkerMLCEngineHandler extends WebWorkerMLCEngineHandler {
|
|
21
|
+
private clientRegistry;
|
|
22
|
+
private initRequestUuid?;
|
|
23
|
+
constructor();
|
|
24
|
+
postMessage(message: WorkerResponse): void;
|
|
25
|
+
onmessage(event: ExtendableMessageEvent, onComplete?: (value: any) => void, onError?: () => void): void;
|
|
26
|
+
}
|
|
27
|
+
export declare class ServiceWorker implements ChatWorker {
|
|
28
|
+
_onmessage: (event: MessageEvent) => void;
|
|
29
|
+
get onmessage(): (event: any) => void;
|
|
30
|
+
set onmessage(handler: (event: any) => void);
|
|
31
|
+
postMessage(message: WorkerRequest): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a ServiceWorkerMLCEngine.
|
|
35
|
+
*
|
|
36
|
+
* @param modelId model_id of the model to load, either string or string[]. When multiple models
|
|
37
|
+
* are provided, we load all models sequentially. Each modelId needs to either be in
|
|
38
|
+
* `webllm.prebuiltAppConfig`, or in `engineCOnfig.appConfig`.
|
|
39
|
+
* @param engineConfig Optionally configures the engine, see `webllm.MLCEngineConfig` for more.
|
|
40
|
+
* @param chatOpts Extra options to optionally override the `mlc-chat-config.json` of `modelId`.
|
|
41
|
+
* The size of which needs to match that of `modelId`; chatOpts[i] will be used for modelId[i].
|
|
42
|
+
* @returns An initialized `WebLLM.ServiceWorkerMLCEngine` with `modelId` loaded.
|
|
43
|
+
*/
|
|
44
|
+
export declare function CreateServiceWorkerMLCEngine(modelId: string | string[], engineConfig?: MLCEngineConfig, chatOpts?: ChatOptions | ChatOptions[], keepAliveMs?: number): Promise<ServiceWorkerMLCEngine>;
|
|
45
|
+
/**
|
|
46
|
+
* A client of MLCEngine that exposes the same interface
|
|
47
|
+
*/
|
|
48
|
+
export declare class ServiceWorkerMLCEngine extends WebWorkerMLCEngine {
|
|
49
|
+
missedHeartbeat: number;
|
|
50
|
+
constructor(engineConfig?: MLCEngineConfig, keepAliveMs?: number);
|
|
51
|
+
onmessage(event: any): void;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=service_worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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,EAAE,GAAG,GAAG,IAAI;CAkB5B"}
|
package/lib/support.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** Util methods. */
|
|
2
|
+
import { Tokenizer } from "@mlc-ai/web-tokenizers";
|
|
3
|
+
import { AppConfig, ModelRecord } from "./config";
|
|
4
|
+
import { ChatCompletionChunk, ChatCompletionContentPartImage, ChatCompletionMessageToolCall } from "./openai_api_protocols/index";
|
|
5
|
+
/**
|
|
6
|
+
* Based on `p_prob` of size (vocabSize,) which becomes a distribution after calling
|
|
7
|
+
* `applySoftmaxWithTemperature()`, sample `top_logprobs` top-probable tokens.
|
|
8
|
+
*
|
|
9
|
+
* @param num_top_probs: `top_logprobs` from ChatCompletionRequest
|
|
10
|
+
* @param p_prob: `logitsOnCPUArray`, being a distribution after `applySoftmaxWithTemperature()`.
|
|
11
|
+
*
|
|
12
|
+
* Followed implementation of `ComputeTopProbsImpl()` from [https://github.com/mlc-ai/mlc-llm/blob/
|
|
13
|
+
* 5b8c529e9704abd09b0432da6dcb4b013fdf43b1/cpp/serve/sampler/cpu_sampler.cc].
|
|
14
|
+
*
|
|
15
|
+
* @returns Arrays of (tokenID, prob) pairs, ranked from highest prob to least.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTopProbs(num_top_probs: number, p_prob: Float32Array): Array<[number, number]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get the token table in the form of a string list of tokens, ordered by their token id.
|
|
20
|
+
* @param tokenizer A loaded tokenizer.
|
|
21
|
+
* @note The size of the table (i.e. tokenizer.getVocabSize()) may be smaller than the `vocab_size`
|
|
22
|
+
* in config.json (length of logits), see https://github.com/QwenLM/Qwen2/issues/147 and
|
|
23
|
+
* https://huggingface.co/microsoft/Phi-3-mini-4k-instruct/discussions/47.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getTokenTableFromTokenizer(tokenizer: Tokenizer): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Postprocess the suffix of ModelRecord.model to be "/resolve/main/" if it is not specified otherwise.
|
|
28
|
+
* e.g. https://huggingface.co/mlc-ai/OpenHermes-2.5-Mistral-7B-q4f16_1-MLC/resolve/main/
|
|
29
|
+
* @return the href of the final URL.
|
|
30
|
+
*/
|
|
31
|
+
export declare function cleanModelUrl(modelUrl: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Json schema used to prompt the model for function calling; directly copied from the official guide.
|
|
34
|
+
* This represents to a single function call.
|
|
35
|
+
*/
|
|
36
|
+
export declare const officialHermes2FunctionCallSchema = "{\"properties\": {\"arguments\": {\"title\": \"Arguments\", \"type\": \"object\"}, \"name\": {\"title\": \"Name\", \"type\": \"string\"}}, \"required\": [\"arguments\", \"name\"], \"title\": \"FunctionCall\", \"type\": \"object\"}";
|
|
37
|
+
/**
|
|
38
|
+
* A list of such function calls. Used to specify response format, since the output is expected to
|
|
39
|
+
* be a list of such function calls.
|
|
40
|
+
*/
|
|
41
|
+
export declare const officialHermes2FunctionCallSchemaArray = "{\"type\":\"array\",\"items\":{\"properties\": {\"arguments\": {\"title\": \"Arguments\", \"type\": \"object\"}, \"name\": {\"title\": \"Name\", \"type\": \"string\"}}, \"required\": [\"arguments\", \"name\"], \"title\": \"FunctionCall\", \"type\": \"object\"}}";
|
|
42
|
+
/**
|
|
43
|
+
* Full system prompt for Hermes-2-Pro function calling.
|
|
44
|
+
*/
|
|
45
|
+
export declare const hermes2FunctionCallingSystemPrompt = "You are a function calling AI model. You are \nprovided with function signatures within <tools></tools> XML tags. You may call one or more functions \nto assist with the user query. Don't make assumptions about what values to plug into functions. Here \nare the available tools: <tools> {hermes_tools} </tools>. \nUse the following pydantic model json schema for each tool call you will make: \n{\"properties\": {\"arguments\": {\"title\": \"Arguments\", \"type\": \"object\"}, \"name\": {\"title\": \"Name\", \"type\": \"string\"}}, \"required\": [\"arguments\", \"name\"], \"title\": \"FunctionCall\", \"type\": \"object\"} For each function call return a json object.";
|
|
46
|
+
/**
|
|
47
|
+
* Given a string outputMessage, parse it as a JSON object and return an array of tool calls.
|
|
48
|
+
*
|
|
49
|
+
* Expect outputMessage to be a valid JSON string, and expect it to be an array of Function with
|
|
50
|
+
* fields `arguments` and `name`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getToolCallFromOutputMessage(outputMessage: string, isStreaming: false): Array<ChatCompletionMessageToolCall>;
|
|
53
|
+
export declare function getToolCallFromOutputMessage(outputMessage: string, isStreaming: true): Array<ChatCompletionChunk.Choice.Delta.ToolCall>;
|
|
54
|
+
export declare function findModelRecord(modelId: string, appConfig: AppConfig): ModelRecord;
|
|
55
|
+
/**
|
|
56
|
+
* Return the model to use given the loaded modelIds and requestModel. Throws error when unclear
|
|
57
|
+
* which model to load.
|
|
58
|
+
* @param loadedModelIds Models currently loaded in the engine.
|
|
59
|
+
* @param requestModel Model the user specified to load via the request. Required when multiple
|
|
60
|
+
* models are loaded
|
|
61
|
+
* @param requestName The type of request or API to load the model for. Needed for error throwing.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getModelIdToUse(loadedModelIds: string[], requestModel: string | undefined | null, requestName: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* TODO: Consider if this is the best strategy (though aligned with mlc-llm). We currently greedily
|
|
66
|
+
* try to fill up prefillChunkSize. Consider the example with 2048 prefill chunk size:
|
|
67
|
+
* const inputData = [
|
|
68
|
+
image1, // 1921
|
|
69
|
+
rangeArr(0, 2048),
|
|
70
|
+
image2,
|
|
71
|
+
];
|
|
72
|
+
* Current approach results in chunks:
|
|
73
|
+
[image1, rangeArr(0, 127)],
|
|
74
|
+
[rangeArr(127, 2048)],
|
|
75
|
+
[image2],
|
|
76
|
+
* This means 4 embedding kernels and 3 prefill kernels.
|
|
77
|
+
* While the optimal chunking may be:
|
|
78
|
+
[image1],
|
|
79
|
+
[rangeArr(0, 2048)],
|
|
80
|
+
[image2],
|
|
81
|
+
* This results in 3 embedding kernels and 3 prefill kernels.
|
|
82
|
+
* However, greedy strategy is more intuitive and probably more generalizable.
|
|
83
|
+
*/
|
|
84
|
+
/**
|
|
85
|
+
* Chunk the inputData such that each chunk's total input length is smaller than prefill
|
|
86
|
+
* chunk size.
|
|
87
|
+
* @returns [the data chunks, the input length of each chunk]
|
|
88
|
+
* @note precondition: if inputData has image in it, then prefillChunkSize >= IMAGE_EMBED_SIZE.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getChunkedPrefillInputData(inputData: Array<Array<number> | ImageURL>, prefillChunkSize: number): [Array<Array<number> | ImageURL>[], Array<number>];
|
|
91
|
+
/**
|
|
92
|
+
* A lock implemented using Promise.
|
|
93
|
+
*
|
|
94
|
+
* Referred to:
|
|
95
|
+
* - https://jackpordi.com/posts/locks-in-js-because-why-not
|
|
96
|
+
* - https://www.linkedin.com/pulse/asynchronous-locking-using-promises-javascript-abdul-ahad-o7smf/
|
|
97
|
+
*/
|
|
98
|
+
export declare class CustomLock {
|
|
99
|
+
private acquired;
|
|
100
|
+
private readonly queue;
|
|
101
|
+
acquire(): Promise<void>;
|
|
102
|
+
release(): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
type ImageURL = ChatCompletionContentPartImage.ImageURL;
|
|
105
|
+
export declare const IMAGE_EMBED_SIZE = 1921;
|
|
106
|
+
/**
|
|
107
|
+
* Given a url, get the image data. The url can either start with `http` or `data:image`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function getImageDataFromURL(url: string): Promise<ImageData>;
|
|
110
|
+
/**
|
|
111
|
+
* Given an ImageData, return the RGB array in Uint8ClampedArray. Note the ImageData.data
|
|
112
|
+
* is RGBA, so we skip every fourth element of the data. The order goes by rows from the
|
|
113
|
+
* top-left pixel to the bottom-right, in RGB order.
|
|
114
|
+
*/
|
|
115
|
+
export declare function getRGBArrayFromImageData(imageData: ImageData): Uint8ClampedArray;
|
|
116
|
+
export {};
|
|
117
|
+
//# sourceMappingURL=support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../src/support.ts"],"names":[],"mappings":"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