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