@cloudflare/workers-types 4.20240423.0 → 4.20240502.0
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/2021-11-03/index.d.ts +274 -17
- package/2021-11-03/index.ts +274 -17
- package/2022-01-31/index.d.ts +274 -17
- package/2022-01-31/index.ts +274 -17
- package/2022-03-21/index.d.ts +274 -17
- package/2022-03-21/index.ts +274 -17
- package/2022-08-04/index.d.ts +274 -17
- package/2022-08-04/index.ts +274 -17
- package/2022-10-31/index.d.ts +274 -17
- package/2022-10-31/index.ts +274 -17
- package/2022-11-30/index.d.ts +274 -17
- package/2022-11-30/index.ts +274 -17
- package/2023-03-01/index.d.ts +274 -17
- package/2023-03-01/index.ts +274 -17
- package/2023-07-01/index.d.ts +274 -17
- package/2023-07-01/index.ts +274 -17
- package/experimental/index.d.ts +281 -18
- package/experimental/index.ts +281 -18
- package/index.d.ts +274 -17
- package/index.ts +274 -17
- package/oldest/index.d.ts +274 -17
- package/oldest/index.ts +274 -17
- package/package.json +1 -1
package/2023-07-01/index.d.ts
CHANGED
|
@@ -218,6 +218,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
218
218
|
clearInterval(timeoutId: number | null): void;
|
|
219
219
|
queueMicrotask(task: Function): void;
|
|
220
220
|
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
221
|
+
reportError(error: any): void;
|
|
221
222
|
fetch(
|
|
222
223
|
input: RequestInfo,
|
|
223
224
|
init?: RequestInit<RequestInitCfProperties>,
|
|
@@ -246,6 +247,7 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
246
247
|
TransformStream: typeof TransformStream;
|
|
247
248
|
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
|
|
248
249
|
CountQueuingStrategy: typeof CountQueuingStrategy;
|
|
250
|
+
ErrorEvent: typeof ErrorEvent;
|
|
249
251
|
ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
|
|
250
252
|
ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
|
|
251
253
|
ReadableByteStreamController: typeof ReadableByteStreamController;
|
|
@@ -349,6 +351,8 @@ declare function structuredClone<T>(
|
|
|
349
351
|
value: T,
|
|
350
352
|
options?: StructuredSerializeOptions,
|
|
351
353
|
): T;
|
|
354
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/reportError) */
|
|
355
|
+
declare function reportError(error: any): void;
|
|
352
356
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
353
357
|
declare function fetch(
|
|
354
358
|
input: RequestInfo,
|
|
@@ -1200,6 +1204,26 @@ declare interface TextEncoderEncodeIntoResult {
|
|
|
1200
1204
|
read: number;
|
|
1201
1205
|
written: number;
|
|
1202
1206
|
}
|
|
1207
|
+
declare class ErrorEvent extends Event {
|
|
1208
|
+
constructor(type: string, init?: ErrorEventErrorEventInit);
|
|
1209
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
|
|
1210
|
+
get filename(): string;
|
|
1211
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
|
|
1212
|
+
get message(): string;
|
|
1213
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
|
|
1214
|
+
get lineno(): number;
|
|
1215
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
|
|
1216
|
+
get colno(): number;
|
|
1217
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
|
|
1218
|
+
get error(): any;
|
|
1219
|
+
}
|
|
1220
|
+
declare interface ErrorEventErrorEventInit {
|
|
1221
|
+
message?: string;
|
|
1222
|
+
filename?: string;
|
|
1223
|
+
lineno?: number;
|
|
1224
|
+
colno?: number;
|
|
1225
|
+
error?: any;
|
|
1226
|
+
}
|
|
1203
1227
|
declare class FormData {
|
|
1204
1228
|
constructor();
|
|
1205
1229
|
append(name: string, value: string): void;
|
|
@@ -2403,23 +2427,6 @@ declare class MessageEvent extends Event {
|
|
|
2403
2427
|
declare interface MessageEventInit {
|
|
2404
2428
|
data: ArrayBuffer | string;
|
|
2405
2429
|
}
|
|
2406
|
-
/**
|
|
2407
|
-
* Events providing information related to errors in scripts or in files.
|
|
2408
|
-
*
|
|
2409
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
|
|
2410
|
-
*/
|
|
2411
|
-
declare interface ErrorEvent extends Event {
|
|
2412
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
|
|
2413
|
-
readonly filename: string;
|
|
2414
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
|
|
2415
|
-
readonly message: string;
|
|
2416
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
|
|
2417
|
-
readonly lineno: number;
|
|
2418
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
|
|
2419
|
-
readonly colno: number;
|
|
2420
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
|
|
2421
|
-
readonly error: any;
|
|
2422
|
-
}
|
|
2423
2430
|
declare type WebSocketEventMap = {
|
|
2424
2431
|
close: CloseEvent;
|
|
2425
2432
|
message: MessageEvent;
|
|
@@ -3023,6 +3030,256 @@ declare interface gpuGPUOrigin3DDict {
|
|
|
3023
3030
|
y?: number;
|
|
3024
3031
|
z?: number;
|
|
3025
3032
|
}
|
|
3033
|
+
declare type AiImageClassificationInput = {
|
|
3034
|
+
image: number[];
|
|
3035
|
+
};
|
|
3036
|
+
declare type AiImageClassificationOutput = {
|
|
3037
|
+
score?: number;
|
|
3038
|
+
label?: string;
|
|
3039
|
+
}[];
|
|
3040
|
+
declare abstract class BaseAiImageClassification {
|
|
3041
|
+
inputs: AiImageClassificationInput;
|
|
3042
|
+
postProcessedOutputs: AiImageClassificationOutput;
|
|
3043
|
+
}
|
|
3044
|
+
declare type AiImageToTextInput = {
|
|
3045
|
+
image: number[];
|
|
3046
|
+
prompt?: string;
|
|
3047
|
+
max_tokens?: number;
|
|
3048
|
+
temperature?: number;
|
|
3049
|
+
raw?: boolean;
|
|
3050
|
+
messages?: RoleScopedChatInput[];
|
|
3051
|
+
};
|
|
3052
|
+
declare type AiImageToTextOutput = {
|
|
3053
|
+
description: string;
|
|
3054
|
+
};
|
|
3055
|
+
declare abstract class BaseAiImageToText {
|
|
3056
|
+
inputs: AiImageToTextInput;
|
|
3057
|
+
postProcessedOutputs: AiImageToTextOutput;
|
|
3058
|
+
}
|
|
3059
|
+
declare type AiObjectDetectionInput = {
|
|
3060
|
+
image: number[];
|
|
3061
|
+
};
|
|
3062
|
+
declare type AiObjectDetectionOutput = {
|
|
3063
|
+
score?: number;
|
|
3064
|
+
label?: string;
|
|
3065
|
+
}[];
|
|
3066
|
+
declare abstract class BaseAiObjectDetection {
|
|
3067
|
+
inputs: AiObjectDetectionInput;
|
|
3068
|
+
postProcessedOutputs: AiObjectDetectionOutput;
|
|
3069
|
+
}
|
|
3070
|
+
declare type AiSentenceSimilarityInput = {
|
|
3071
|
+
source: string;
|
|
3072
|
+
sentences: string[];
|
|
3073
|
+
};
|
|
3074
|
+
declare type AiSentenceSimilarityOutput = number[];
|
|
3075
|
+
declare abstract class BaseAiSentenceSimilarity {
|
|
3076
|
+
inputs: AiSentenceSimilarityInput;
|
|
3077
|
+
postProcessedOutputs: AiSentenceSimilarityOutput;
|
|
3078
|
+
}
|
|
3079
|
+
declare type AiSpeechRecognitionInput = {
|
|
3080
|
+
audio: number[];
|
|
3081
|
+
};
|
|
3082
|
+
declare type AiSpeechRecognitionOutput = {
|
|
3083
|
+
text?: string;
|
|
3084
|
+
words?: {
|
|
3085
|
+
word: string;
|
|
3086
|
+
start: number;
|
|
3087
|
+
end: number;
|
|
3088
|
+
}[];
|
|
3089
|
+
vtt?: string;
|
|
3090
|
+
};
|
|
3091
|
+
declare abstract class BaseAiSpeechRecognition {
|
|
3092
|
+
inputs: AiSpeechRecognitionInput;
|
|
3093
|
+
postProcessedOutputs: AiSpeechRecognitionOutput;
|
|
3094
|
+
}
|
|
3095
|
+
declare type AiSummarizationInput = {
|
|
3096
|
+
input_text: string;
|
|
3097
|
+
max_length?: number;
|
|
3098
|
+
};
|
|
3099
|
+
declare type AiSummarizationOutput = {
|
|
3100
|
+
summary: string;
|
|
3101
|
+
};
|
|
3102
|
+
declare abstract class BaseAiSummarization {
|
|
3103
|
+
inputs: AiSummarizationInput;
|
|
3104
|
+
postProcessedOutputs: AiSummarizationOutput;
|
|
3105
|
+
}
|
|
3106
|
+
declare type AiTextClassificationInput = {
|
|
3107
|
+
text: string;
|
|
3108
|
+
};
|
|
3109
|
+
declare type AiTextClassificationOutput = {
|
|
3110
|
+
score?: number;
|
|
3111
|
+
label?: string;
|
|
3112
|
+
}[];
|
|
3113
|
+
declare abstract class BaseAiTextClassification {
|
|
3114
|
+
inputs: AiTextClassificationInput;
|
|
3115
|
+
postProcessedOutputs: AiTextClassificationOutput;
|
|
3116
|
+
}
|
|
3117
|
+
declare type AiTextEmbeddingsInput = {
|
|
3118
|
+
text: string | string[];
|
|
3119
|
+
};
|
|
3120
|
+
declare type AiTextEmbeddingsOutput = {
|
|
3121
|
+
shape: number[];
|
|
3122
|
+
data: number[][];
|
|
3123
|
+
};
|
|
3124
|
+
declare abstract class BaseAiTextEmbeddings {
|
|
3125
|
+
inputs: AiTextEmbeddingsInput;
|
|
3126
|
+
postProcessedOutputs: AiTextEmbeddingsOutput;
|
|
3127
|
+
}
|
|
3128
|
+
declare type RoleScopedChatInput = {
|
|
3129
|
+
role: string;
|
|
3130
|
+
content: string;
|
|
3131
|
+
};
|
|
3132
|
+
declare type AiTextGenerationInput = {
|
|
3133
|
+
prompt?: string;
|
|
3134
|
+
raw?: boolean;
|
|
3135
|
+
stream?: boolean;
|
|
3136
|
+
max_tokens?: number;
|
|
3137
|
+
messages?: RoleScopedChatInput[];
|
|
3138
|
+
};
|
|
3139
|
+
declare type AiTextGenerationOutput =
|
|
3140
|
+
| {
|
|
3141
|
+
response?: string;
|
|
3142
|
+
}
|
|
3143
|
+
| ReadableStream;
|
|
3144
|
+
declare abstract class BaseAiTextGeneration {
|
|
3145
|
+
inputs: AiTextGenerationInput;
|
|
3146
|
+
postProcessedOutputs: AiTextGenerationOutput;
|
|
3147
|
+
}
|
|
3148
|
+
declare type AiTextToImageInput = {
|
|
3149
|
+
prompt: string;
|
|
3150
|
+
image?: number[];
|
|
3151
|
+
mask?: number[];
|
|
3152
|
+
num_steps?: number;
|
|
3153
|
+
strength?: number;
|
|
3154
|
+
guidance?: number;
|
|
3155
|
+
};
|
|
3156
|
+
declare type AiTextToImageOutput = Uint8Array;
|
|
3157
|
+
declare abstract class BaseAiTextToImage {
|
|
3158
|
+
inputs: AiTextToImageInput;
|
|
3159
|
+
postProcessedOutputs: AiTextToImageOutput;
|
|
3160
|
+
}
|
|
3161
|
+
declare type AiTranslationInput = {
|
|
3162
|
+
text: string;
|
|
3163
|
+
target_lang: string;
|
|
3164
|
+
source_lang?: string;
|
|
3165
|
+
};
|
|
3166
|
+
declare type AiTranslationOutput = {
|
|
3167
|
+
translated_text?: string;
|
|
3168
|
+
};
|
|
3169
|
+
declare abstract class BaseAiTranslation {
|
|
3170
|
+
inputs: AiTranslationInput;
|
|
3171
|
+
postProcessedOutputs: AiTranslationOutput;
|
|
3172
|
+
}
|
|
3173
|
+
declare type AiOptions = {
|
|
3174
|
+
prefix?: string;
|
|
3175
|
+
extraHeaders?: object;
|
|
3176
|
+
};
|
|
3177
|
+
declare abstract class Ai {
|
|
3178
|
+
run(
|
|
3179
|
+
model:
|
|
3180
|
+
| "@cf/huggingface/distilbert-sst-2-int8"
|
|
3181
|
+
| "@cf/jpmorganchase/roberta-spam"
|
|
3182
|
+
| "@cf/inml/inml-roberta-dga",
|
|
3183
|
+
inputs: BaseAiTextClassification["inputs"],
|
|
3184
|
+
options?: AiOptions,
|
|
3185
|
+
): Promise<BaseAiTextClassification["postProcessedOutputs"]>;
|
|
3186
|
+
run(
|
|
3187
|
+
model:
|
|
3188
|
+
| "@cf/stabilityai/stable-diffusion-xl-base-1.0"
|
|
3189
|
+
| "@cf/runwayml/stable-diffusion-v1-5-inpainting"
|
|
3190
|
+
| "@cf/runwayml/stable-diffusion-v1-5-img2img"
|
|
3191
|
+
| "@cf/lykon/dreamshaper-8-lcm"
|
|
3192
|
+
| "@cf/bytedance/stable-diffusion-xl-lightning",
|
|
3193
|
+
inputs: BaseAiTextToImage["inputs"],
|
|
3194
|
+
options?: AiOptions,
|
|
3195
|
+
): Promise<BaseAiTextToImage["postProcessedOutputs"]>;
|
|
3196
|
+
run(
|
|
3197
|
+
model: "@hf/sentence-transformers/all-minilm-l6-v2",
|
|
3198
|
+
inputs: BaseAiSentenceSimilarity["inputs"],
|
|
3199
|
+
options?: AiOptions,
|
|
3200
|
+
): Promise<BaseAiSentenceSimilarity["postProcessedOutputs"]>;
|
|
3201
|
+
run(
|
|
3202
|
+
model:
|
|
3203
|
+
| "@cf/baai/bge-small-en-v1.5"
|
|
3204
|
+
| "@cf/baai/bge-base-en-v1.5"
|
|
3205
|
+
| "@cf/baai/bge-large-en-v1.5",
|
|
3206
|
+
inputs: BaseAiTextEmbeddings["inputs"],
|
|
3207
|
+
options?: AiOptions,
|
|
3208
|
+
): Promise<BaseAiTextEmbeddings["postProcessedOutputs"]>;
|
|
3209
|
+
run(
|
|
3210
|
+
model:
|
|
3211
|
+
| "@cf/openai/whisper"
|
|
3212
|
+
| "@cf/openai/whisper-tiny-en"
|
|
3213
|
+
| "@cf/openai/whisper-sherpa",
|
|
3214
|
+
inputs: BaseAiSpeechRecognition["inputs"],
|
|
3215
|
+
options?: AiOptions,
|
|
3216
|
+
): Promise<BaseAiSpeechRecognition["postProcessedOutputs"]>;
|
|
3217
|
+
run(
|
|
3218
|
+
model: "@cf/microsoft/resnet-50",
|
|
3219
|
+
inputs: BaseAiImageClassification["inputs"],
|
|
3220
|
+
options?: AiOptions,
|
|
3221
|
+
): Promise<BaseAiImageClassification["postProcessedOutputs"]>;
|
|
3222
|
+
run(
|
|
3223
|
+
model: "@cf/facebook/detr-resnet-50",
|
|
3224
|
+
inputs: BaseAiObjectDetection["inputs"],
|
|
3225
|
+
options?: AiOptions,
|
|
3226
|
+
): Promise<BaseAiObjectDetection["postProcessedOutputs"]>;
|
|
3227
|
+
run(
|
|
3228
|
+
model:
|
|
3229
|
+
| "@cf/meta/llama-3-8b-instruct"
|
|
3230
|
+
| "@cf/meta/llama-2-7b-chat-int8"
|
|
3231
|
+
| "@cf/mistral/mistral-7b-instruct-v0.1"
|
|
3232
|
+
| "@cf/mistral/mistral-7b-instruct-v0.1-vllm"
|
|
3233
|
+
| "@cf/mistral/mistral-7b-instruct-v0.2-lora"
|
|
3234
|
+
| "@cf/meta/llama-2-7b-chat-fp16"
|
|
3235
|
+
| "@hf/thebloke/llama-2-13b-chat-awq"
|
|
3236
|
+
| "@hf/thebloke/zephyr-7b-beta-awq"
|
|
3237
|
+
| "@hf/thebloke/mistral-7b-instruct-v0.1-awq"
|
|
3238
|
+
| "@hf/thebloke/codellama-7b-instruct-awq"
|
|
3239
|
+
| "@hf/thebloke/openchat_3.5-awq"
|
|
3240
|
+
| "@hf/thebloke/openhermes-2.5-mistral-7b-awq"
|
|
3241
|
+
| "@hf/thebloke/neural-chat-7b-v3-1-awq"
|
|
3242
|
+
| "@hf/thebloke/llamaguard-7b-awq"
|
|
3243
|
+
| "@hf/thebloke/deepseek-coder-6.7b-base-awq"
|
|
3244
|
+
| "@hf/thebloke/deepseek-coder-6.7b-instruct-awq"
|
|
3245
|
+
| "@hf/nousresearch/hermes-2-pro-mistral-7b"
|
|
3246
|
+
| "@hf/mistral/mistral-7b-instruct-v0.2"
|
|
3247
|
+
| "@cf/mistral/mixtral-8x7b-instruct-v0.1-awq"
|
|
3248
|
+
| "@hf/google/gemma-7b-it"
|
|
3249
|
+
| "@hf/nexusflow/starling-lm-7b-beta"
|
|
3250
|
+
| "@cf/deepseek-ai/deepseek-math-7b-instruct"
|
|
3251
|
+
| "@cf/defog/sqlcoder-7b-2"
|
|
3252
|
+
| "@cf/openchat/openchat-3.5-0106"
|
|
3253
|
+
| "@cf/tiiuae/falcon-7b-instruct"
|
|
3254
|
+
| "@cf/thebloke/discolm-german-7b-v1-awq"
|
|
3255
|
+
| "@cf/qwen/qwen1.5-0.5b-chat"
|
|
3256
|
+
| "@cf/qwen/qwen1.5-1.8b-chat"
|
|
3257
|
+
| "@cf/qwen/qwen1.5-7b-chat-awq"
|
|
3258
|
+
| "@cf/qwen/qwen1.5-14b-chat-awq"
|
|
3259
|
+
| "@cf/tinyllama/tinyllama-1.1b-chat-v1.0"
|
|
3260
|
+
| "@cf/microsoft/phi-2"
|
|
3261
|
+
| "@cf/google/gemma-2b-it-lora"
|
|
3262
|
+
| "@cf/google/gemma-7b-it-lora"
|
|
3263
|
+
| "@cf/meta-llama/llama-2-7b-chat-hf-lora",
|
|
3264
|
+
inputs: BaseAiTextGeneration["inputs"],
|
|
3265
|
+
options?: AiOptions,
|
|
3266
|
+
): Promise<BaseAiTextGeneration["postProcessedOutputs"]>;
|
|
3267
|
+
run(
|
|
3268
|
+
model: "@cf/meta/m2m100-1.2b",
|
|
3269
|
+
inputs: BaseAiTranslation["inputs"],
|
|
3270
|
+
options?: AiOptions,
|
|
3271
|
+
): Promise<BaseAiTranslation["postProcessedOutputs"]>;
|
|
3272
|
+
run(
|
|
3273
|
+
model: "@cf/facebook/bart-large-cnn",
|
|
3274
|
+
inputs: BaseAiSummarization["inputs"],
|
|
3275
|
+
options?: AiOptions,
|
|
3276
|
+
): Promise<BaseAiSummarization["postProcessedOutputs"]>;
|
|
3277
|
+
run(
|
|
3278
|
+
model: "@cf/unum/uform-gen2-qwen-500m" | "@cf/llava-hf/llava-1.5-7b-hf",
|
|
3279
|
+
inputs: BaseAiImageToText["inputs"],
|
|
3280
|
+
options?: AiOptions,
|
|
3281
|
+
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
3282
|
+
}
|
|
3026
3283
|
declare interface BasicImageTransformations {
|
|
3027
3284
|
/**
|
|
3028
3285
|
* Maximum width in image pixels. The value must be an integer.
|
package/2023-07-01/index.ts
CHANGED
|
@@ -218,6 +218,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
218
218
|
clearInterval(timeoutId: number | null): void;
|
|
219
219
|
queueMicrotask(task: Function): void;
|
|
220
220
|
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
221
|
+
reportError(error: any): void;
|
|
221
222
|
fetch(
|
|
222
223
|
input: RequestInfo,
|
|
223
224
|
init?: RequestInit<RequestInitCfProperties>,
|
|
@@ -246,6 +247,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
246
247
|
TransformStream: typeof TransformStream;
|
|
247
248
|
ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
|
|
248
249
|
CountQueuingStrategy: typeof CountQueuingStrategy;
|
|
250
|
+
ErrorEvent: typeof ErrorEvent;
|
|
249
251
|
ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
|
|
250
252
|
ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
|
|
251
253
|
ReadableByteStreamController: typeof ReadableByteStreamController;
|
|
@@ -351,6 +353,8 @@ export declare function structuredClone<T>(
|
|
|
351
353
|
value: T,
|
|
352
354
|
options?: StructuredSerializeOptions,
|
|
353
355
|
): T;
|
|
356
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/reportError) */
|
|
357
|
+
export declare function reportError(error: any): void;
|
|
354
358
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
355
359
|
export declare function fetch(
|
|
356
360
|
input: RequestInfo,
|
|
@@ -1202,6 +1206,26 @@ export interface TextEncoderEncodeIntoResult {
|
|
|
1202
1206
|
read: number;
|
|
1203
1207
|
written: number;
|
|
1204
1208
|
}
|
|
1209
|
+
export declare class ErrorEvent extends Event {
|
|
1210
|
+
constructor(type: string, init?: ErrorEventErrorEventInit);
|
|
1211
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
|
|
1212
|
+
get filename(): string;
|
|
1213
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
|
|
1214
|
+
get message(): string;
|
|
1215
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
|
|
1216
|
+
get lineno(): number;
|
|
1217
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
|
|
1218
|
+
get colno(): number;
|
|
1219
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
|
|
1220
|
+
get error(): any;
|
|
1221
|
+
}
|
|
1222
|
+
export interface ErrorEventErrorEventInit {
|
|
1223
|
+
message?: string;
|
|
1224
|
+
filename?: string;
|
|
1225
|
+
lineno?: number;
|
|
1226
|
+
colno?: number;
|
|
1227
|
+
error?: any;
|
|
1228
|
+
}
|
|
1205
1229
|
export declare class FormData {
|
|
1206
1230
|
constructor();
|
|
1207
1231
|
append(name: string, value: string): void;
|
|
@@ -2408,23 +2432,6 @@ export declare class MessageEvent extends Event {
|
|
|
2408
2432
|
export interface MessageEventInit {
|
|
2409
2433
|
data: ArrayBuffer | string;
|
|
2410
2434
|
}
|
|
2411
|
-
/**
|
|
2412
|
-
* Events providing information related to errors in scripts or in files.
|
|
2413
|
-
*
|
|
2414
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)
|
|
2415
|
-
*/
|
|
2416
|
-
export interface ErrorEvent extends Event {
|
|
2417
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */
|
|
2418
|
-
readonly filename: string;
|
|
2419
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */
|
|
2420
|
-
readonly message: string;
|
|
2421
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */
|
|
2422
|
-
readonly lineno: number;
|
|
2423
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */
|
|
2424
|
-
readonly colno: number;
|
|
2425
|
-
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */
|
|
2426
|
-
readonly error: any;
|
|
2427
|
-
}
|
|
2428
2435
|
export type WebSocketEventMap = {
|
|
2429
2436
|
close: CloseEvent;
|
|
2430
2437
|
message: MessageEvent;
|
|
@@ -3028,6 +3035,256 @@ export interface gpuGPUOrigin3DDict {
|
|
|
3028
3035
|
y?: number;
|
|
3029
3036
|
z?: number;
|
|
3030
3037
|
}
|
|
3038
|
+
export type AiImageClassificationInput = {
|
|
3039
|
+
image: number[];
|
|
3040
|
+
};
|
|
3041
|
+
export type AiImageClassificationOutput = {
|
|
3042
|
+
score?: number;
|
|
3043
|
+
label?: string;
|
|
3044
|
+
}[];
|
|
3045
|
+
export declare abstract class BaseAiImageClassification {
|
|
3046
|
+
inputs: AiImageClassificationInput;
|
|
3047
|
+
postProcessedOutputs: AiImageClassificationOutput;
|
|
3048
|
+
}
|
|
3049
|
+
export type AiImageToTextInput = {
|
|
3050
|
+
image: number[];
|
|
3051
|
+
prompt?: string;
|
|
3052
|
+
max_tokens?: number;
|
|
3053
|
+
temperature?: number;
|
|
3054
|
+
raw?: boolean;
|
|
3055
|
+
messages?: RoleScopedChatInput[];
|
|
3056
|
+
};
|
|
3057
|
+
export type AiImageToTextOutput = {
|
|
3058
|
+
description: string;
|
|
3059
|
+
};
|
|
3060
|
+
export declare abstract class BaseAiImageToText {
|
|
3061
|
+
inputs: AiImageToTextInput;
|
|
3062
|
+
postProcessedOutputs: AiImageToTextOutput;
|
|
3063
|
+
}
|
|
3064
|
+
export type AiObjectDetectionInput = {
|
|
3065
|
+
image: number[];
|
|
3066
|
+
};
|
|
3067
|
+
export type AiObjectDetectionOutput = {
|
|
3068
|
+
score?: number;
|
|
3069
|
+
label?: string;
|
|
3070
|
+
}[];
|
|
3071
|
+
export declare abstract class BaseAiObjectDetection {
|
|
3072
|
+
inputs: AiObjectDetectionInput;
|
|
3073
|
+
postProcessedOutputs: AiObjectDetectionOutput;
|
|
3074
|
+
}
|
|
3075
|
+
export type AiSentenceSimilarityInput = {
|
|
3076
|
+
source: string;
|
|
3077
|
+
sentences: string[];
|
|
3078
|
+
};
|
|
3079
|
+
export type AiSentenceSimilarityOutput = number[];
|
|
3080
|
+
export declare abstract class BaseAiSentenceSimilarity {
|
|
3081
|
+
inputs: AiSentenceSimilarityInput;
|
|
3082
|
+
postProcessedOutputs: AiSentenceSimilarityOutput;
|
|
3083
|
+
}
|
|
3084
|
+
export type AiSpeechRecognitionInput = {
|
|
3085
|
+
audio: number[];
|
|
3086
|
+
};
|
|
3087
|
+
export type AiSpeechRecognitionOutput = {
|
|
3088
|
+
text?: string;
|
|
3089
|
+
words?: {
|
|
3090
|
+
word: string;
|
|
3091
|
+
start: number;
|
|
3092
|
+
end: number;
|
|
3093
|
+
}[];
|
|
3094
|
+
vtt?: string;
|
|
3095
|
+
};
|
|
3096
|
+
export declare abstract class BaseAiSpeechRecognition {
|
|
3097
|
+
inputs: AiSpeechRecognitionInput;
|
|
3098
|
+
postProcessedOutputs: AiSpeechRecognitionOutput;
|
|
3099
|
+
}
|
|
3100
|
+
export type AiSummarizationInput = {
|
|
3101
|
+
input_text: string;
|
|
3102
|
+
max_length?: number;
|
|
3103
|
+
};
|
|
3104
|
+
export type AiSummarizationOutput = {
|
|
3105
|
+
summary: string;
|
|
3106
|
+
};
|
|
3107
|
+
export declare abstract class BaseAiSummarization {
|
|
3108
|
+
inputs: AiSummarizationInput;
|
|
3109
|
+
postProcessedOutputs: AiSummarizationOutput;
|
|
3110
|
+
}
|
|
3111
|
+
export type AiTextClassificationInput = {
|
|
3112
|
+
text: string;
|
|
3113
|
+
};
|
|
3114
|
+
export type AiTextClassificationOutput = {
|
|
3115
|
+
score?: number;
|
|
3116
|
+
label?: string;
|
|
3117
|
+
}[];
|
|
3118
|
+
export declare abstract class BaseAiTextClassification {
|
|
3119
|
+
inputs: AiTextClassificationInput;
|
|
3120
|
+
postProcessedOutputs: AiTextClassificationOutput;
|
|
3121
|
+
}
|
|
3122
|
+
export type AiTextEmbeddingsInput = {
|
|
3123
|
+
text: string | string[];
|
|
3124
|
+
};
|
|
3125
|
+
export type AiTextEmbeddingsOutput = {
|
|
3126
|
+
shape: number[];
|
|
3127
|
+
data: number[][];
|
|
3128
|
+
};
|
|
3129
|
+
export declare abstract class BaseAiTextEmbeddings {
|
|
3130
|
+
inputs: AiTextEmbeddingsInput;
|
|
3131
|
+
postProcessedOutputs: AiTextEmbeddingsOutput;
|
|
3132
|
+
}
|
|
3133
|
+
export type RoleScopedChatInput = {
|
|
3134
|
+
role: string;
|
|
3135
|
+
content: string;
|
|
3136
|
+
};
|
|
3137
|
+
export type AiTextGenerationInput = {
|
|
3138
|
+
prompt?: string;
|
|
3139
|
+
raw?: boolean;
|
|
3140
|
+
stream?: boolean;
|
|
3141
|
+
max_tokens?: number;
|
|
3142
|
+
messages?: RoleScopedChatInput[];
|
|
3143
|
+
};
|
|
3144
|
+
export type AiTextGenerationOutput =
|
|
3145
|
+
| {
|
|
3146
|
+
response?: string;
|
|
3147
|
+
}
|
|
3148
|
+
| ReadableStream;
|
|
3149
|
+
export declare abstract class BaseAiTextGeneration {
|
|
3150
|
+
inputs: AiTextGenerationInput;
|
|
3151
|
+
postProcessedOutputs: AiTextGenerationOutput;
|
|
3152
|
+
}
|
|
3153
|
+
export type AiTextToImageInput = {
|
|
3154
|
+
prompt: string;
|
|
3155
|
+
image?: number[];
|
|
3156
|
+
mask?: number[];
|
|
3157
|
+
num_steps?: number;
|
|
3158
|
+
strength?: number;
|
|
3159
|
+
guidance?: number;
|
|
3160
|
+
};
|
|
3161
|
+
export type AiTextToImageOutput = Uint8Array;
|
|
3162
|
+
export declare abstract class BaseAiTextToImage {
|
|
3163
|
+
inputs: AiTextToImageInput;
|
|
3164
|
+
postProcessedOutputs: AiTextToImageOutput;
|
|
3165
|
+
}
|
|
3166
|
+
export type AiTranslationInput = {
|
|
3167
|
+
text: string;
|
|
3168
|
+
target_lang: string;
|
|
3169
|
+
source_lang?: string;
|
|
3170
|
+
};
|
|
3171
|
+
export type AiTranslationOutput = {
|
|
3172
|
+
translated_text?: string;
|
|
3173
|
+
};
|
|
3174
|
+
export declare abstract class BaseAiTranslation {
|
|
3175
|
+
inputs: AiTranslationInput;
|
|
3176
|
+
postProcessedOutputs: AiTranslationOutput;
|
|
3177
|
+
}
|
|
3178
|
+
export type AiOptions = {
|
|
3179
|
+
prefix?: string;
|
|
3180
|
+
extraHeaders?: object;
|
|
3181
|
+
};
|
|
3182
|
+
export declare abstract class Ai {
|
|
3183
|
+
run(
|
|
3184
|
+
model:
|
|
3185
|
+
| "@cf/huggingface/distilbert-sst-2-int8"
|
|
3186
|
+
| "@cf/jpmorganchase/roberta-spam"
|
|
3187
|
+
| "@cf/inml/inml-roberta-dga",
|
|
3188
|
+
inputs: BaseAiTextClassification["inputs"],
|
|
3189
|
+
options?: AiOptions,
|
|
3190
|
+
): Promise<BaseAiTextClassification["postProcessedOutputs"]>;
|
|
3191
|
+
run(
|
|
3192
|
+
model:
|
|
3193
|
+
| "@cf/stabilityai/stable-diffusion-xl-base-1.0"
|
|
3194
|
+
| "@cf/runwayml/stable-diffusion-v1-5-inpainting"
|
|
3195
|
+
| "@cf/runwayml/stable-diffusion-v1-5-img2img"
|
|
3196
|
+
| "@cf/lykon/dreamshaper-8-lcm"
|
|
3197
|
+
| "@cf/bytedance/stable-diffusion-xl-lightning",
|
|
3198
|
+
inputs: BaseAiTextToImage["inputs"],
|
|
3199
|
+
options?: AiOptions,
|
|
3200
|
+
): Promise<BaseAiTextToImage["postProcessedOutputs"]>;
|
|
3201
|
+
run(
|
|
3202
|
+
model: "@hf/sentence-transformers/all-minilm-l6-v2",
|
|
3203
|
+
inputs: BaseAiSentenceSimilarity["inputs"],
|
|
3204
|
+
options?: AiOptions,
|
|
3205
|
+
): Promise<BaseAiSentenceSimilarity["postProcessedOutputs"]>;
|
|
3206
|
+
run(
|
|
3207
|
+
model:
|
|
3208
|
+
| "@cf/baai/bge-small-en-v1.5"
|
|
3209
|
+
| "@cf/baai/bge-base-en-v1.5"
|
|
3210
|
+
| "@cf/baai/bge-large-en-v1.5",
|
|
3211
|
+
inputs: BaseAiTextEmbeddings["inputs"],
|
|
3212
|
+
options?: AiOptions,
|
|
3213
|
+
): Promise<BaseAiTextEmbeddings["postProcessedOutputs"]>;
|
|
3214
|
+
run(
|
|
3215
|
+
model:
|
|
3216
|
+
| "@cf/openai/whisper"
|
|
3217
|
+
| "@cf/openai/whisper-tiny-en"
|
|
3218
|
+
| "@cf/openai/whisper-sherpa",
|
|
3219
|
+
inputs: BaseAiSpeechRecognition["inputs"],
|
|
3220
|
+
options?: AiOptions,
|
|
3221
|
+
): Promise<BaseAiSpeechRecognition["postProcessedOutputs"]>;
|
|
3222
|
+
run(
|
|
3223
|
+
model: "@cf/microsoft/resnet-50",
|
|
3224
|
+
inputs: BaseAiImageClassification["inputs"],
|
|
3225
|
+
options?: AiOptions,
|
|
3226
|
+
): Promise<BaseAiImageClassification["postProcessedOutputs"]>;
|
|
3227
|
+
run(
|
|
3228
|
+
model: "@cf/facebook/detr-resnet-50",
|
|
3229
|
+
inputs: BaseAiObjectDetection["inputs"],
|
|
3230
|
+
options?: AiOptions,
|
|
3231
|
+
): Promise<BaseAiObjectDetection["postProcessedOutputs"]>;
|
|
3232
|
+
run(
|
|
3233
|
+
model:
|
|
3234
|
+
| "@cf/meta/llama-3-8b-instruct"
|
|
3235
|
+
| "@cf/meta/llama-2-7b-chat-int8"
|
|
3236
|
+
| "@cf/mistral/mistral-7b-instruct-v0.1"
|
|
3237
|
+
| "@cf/mistral/mistral-7b-instruct-v0.1-vllm"
|
|
3238
|
+
| "@cf/mistral/mistral-7b-instruct-v0.2-lora"
|
|
3239
|
+
| "@cf/meta/llama-2-7b-chat-fp16"
|
|
3240
|
+
| "@hf/thebloke/llama-2-13b-chat-awq"
|
|
3241
|
+
| "@hf/thebloke/zephyr-7b-beta-awq"
|
|
3242
|
+
| "@hf/thebloke/mistral-7b-instruct-v0.1-awq"
|
|
3243
|
+
| "@hf/thebloke/codellama-7b-instruct-awq"
|
|
3244
|
+
| "@hf/thebloke/openchat_3.5-awq"
|
|
3245
|
+
| "@hf/thebloke/openhermes-2.5-mistral-7b-awq"
|
|
3246
|
+
| "@hf/thebloke/neural-chat-7b-v3-1-awq"
|
|
3247
|
+
| "@hf/thebloke/llamaguard-7b-awq"
|
|
3248
|
+
| "@hf/thebloke/deepseek-coder-6.7b-base-awq"
|
|
3249
|
+
| "@hf/thebloke/deepseek-coder-6.7b-instruct-awq"
|
|
3250
|
+
| "@hf/nousresearch/hermes-2-pro-mistral-7b"
|
|
3251
|
+
| "@hf/mistral/mistral-7b-instruct-v0.2"
|
|
3252
|
+
| "@cf/mistral/mixtral-8x7b-instruct-v0.1-awq"
|
|
3253
|
+
| "@hf/google/gemma-7b-it"
|
|
3254
|
+
| "@hf/nexusflow/starling-lm-7b-beta"
|
|
3255
|
+
| "@cf/deepseek-ai/deepseek-math-7b-instruct"
|
|
3256
|
+
| "@cf/defog/sqlcoder-7b-2"
|
|
3257
|
+
| "@cf/openchat/openchat-3.5-0106"
|
|
3258
|
+
| "@cf/tiiuae/falcon-7b-instruct"
|
|
3259
|
+
| "@cf/thebloke/discolm-german-7b-v1-awq"
|
|
3260
|
+
| "@cf/qwen/qwen1.5-0.5b-chat"
|
|
3261
|
+
| "@cf/qwen/qwen1.5-1.8b-chat"
|
|
3262
|
+
| "@cf/qwen/qwen1.5-7b-chat-awq"
|
|
3263
|
+
| "@cf/qwen/qwen1.5-14b-chat-awq"
|
|
3264
|
+
| "@cf/tinyllama/tinyllama-1.1b-chat-v1.0"
|
|
3265
|
+
| "@cf/microsoft/phi-2"
|
|
3266
|
+
| "@cf/google/gemma-2b-it-lora"
|
|
3267
|
+
| "@cf/google/gemma-7b-it-lora"
|
|
3268
|
+
| "@cf/meta-llama/llama-2-7b-chat-hf-lora",
|
|
3269
|
+
inputs: BaseAiTextGeneration["inputs"],
|
|
3270
|
+
options?: AiOptions,
|
|
3271
|
+
): Promise<BaseAiTextGeneration["postProcessedOutputs"]>;
|
|
3272
|
+
run(
|
|
3273
|
+
model: "@cf/meta/m2m100-1.2b",
|
|
3274
|
+
inputs: BaseAiTranslation["inputs"],
|
|
3275
|
+
options?: AiOptions,
|
|
3276
|
+
): Promise<BaseAiTranslation["postProcessedOutputs"]>;
|
|
3277
|
+
run(
|
|
3278
|
+
model: "@cf/facebook/bart-large-cnn",
|
|
3279
|
+
inputs: BaseAiSummarization["inputs"],
|
|
3280
|
+
options?: AiOptions,
|
|
3281
|
+
): Promise<BaseAiSummarization["postProcessedOutputs"]>;
|
|
3282
|
+
run(
|
|
3283
|
+
model: "@cf/unum/uform-gen2-qwen-500m" | "@cf/llava-hf/llava-1.5-7b-hf",
|
|
3284
|
+
inputs: BaseAiImageToText["inputs"],
|
|
3285
|
+
options?: AiOptions,
|
|
3286
|
+
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
3287
|
+
}
|
|
3031
3288
|
export interface BasicImageTransformations {
|
|
3032
3289
|
/**
|
|
3033
3290
|
* Maximum width in image pixels. The value must be an integer.
|