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