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