@workers-community/workers-types 4.20260329.1 → 4.20260401.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +413 -131
  2. package/index.ts +413 -131
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3103,6 +3103,11 @@ interface QueuingStrategyInit {
3103
3103
  */
3104
3104
  highWaterMark: number;
3105
3105
  }
3106
+ interface TracePreviewInfo {
3107
+ id: string;
3108
+ slug: string;
3109
+ name: string;
3110
+ }
3106
3111
  interface ScriptVersion {
3107
3112
  id?: string;
3108
3113
  tag?: string;
@@ -3137,6 +3142,7 @@ interface TraceItem {
3137
3142
  readonly dispatchNamespace?: string;
3138
3143
  readonly scriptTags?: string[];
3139
3144
  readonly tailAttributes?: Record<string, boolean | number | string>;
3145
+ readonly preview?: TracePreviewInfo;
3140
3146
  readonly durableObjectId?: string;
3141
3147
  readonly outcome: string;
3142
3148
  readonly executionModel: string;
@@ -3763,12 +3769,42 @@ interface Container {
3763
3769
  setInactivityTimeout(durationMs: number | bigint): Promise<void>;
3764
3770
  interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
3765
3771
  interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
3772
+ snapshotDirectory(
3773
+ options: ContainerDirectorySnapshotOptions,
3774
+ ): Promise<ContainerDirectorySnapshot>;
3775
+ snapshotContainer(
3776
+ options: ContainerSnapshotOptions,
3777
+ ): Promise<ContainerSnapshot>;
3778
+ }
3779
+ interface ContainerDirectorySnapshot {
3780
+ id: string;
3781
+ size: number;
3782
+ dir: string;
3783
+ name?: string;
3784
+ }
3785
+ interface ContainerDirectorySnapshotOptions {
3786
+ dir: string;
3787
+ name?: string;
3788
+ }
3789
+ interface ContainerDirectorySnapshotRestoreParams {
3790
+ snapshot: ContainerDirectorySnapshot;
3791
+ mountPoint?: string;
3792
+ }
3793
+ interface ContainerSnapshot {
3794
+ id: string;
3795
+ size: number;
3796
+ name?: string;
3797
+ }
3798
+ interface ContainerSnapshotOptions {
3799
+ name?: string;
3766
3800
  }
3767
3801
  interface ContainerStartupOptions {
3768
3802
  entrypoint?: string[];
3769
3803
  enableInternet: boolean;
3770
3804
  env?: Record<string, string>;
3771
3805
  labels?: Record<string, string>;
3806
+ directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
3807
+ containerSnapshot?: ContainerSnapshot;
3772
3808
  }
3773
3809
  /**
3774
3810
  * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
@@ -3895,11 +3931,10 @@ declare abstract class Performance {
3895
3931
  */
3896
3932
  toJSON(): object;
3897
3933
  }
3898
- // AI Search V2 API Error Interfaces
3934
+ // ============ AI Search Error Interfaces ============
3899
3935
  interface AiSearchInternalError extends Error {}
3900
3936
  interface AiSearchNotFoundError extends Error {}
3901
- interface AiSearchNameNotSetError extends Error {}
3902
- // AI Search V2 Request Types
3937
+ // ============ AI Search Request Types ============
3903
3938
  type AiSearchSearchRequest = {
3904
3939
  messages: Array<{
3905
3940
  role: "system" | "developer" | "user" | "assistant" | "tool";
@@ -3924,9 +3959,8 @@ type AiSearchSearchRequest = {
3924
3959
  [key: string]: unknown;
3925
3960
  };
3926
3961
  reranking?: {
3927
- /** Enable reranking (default false) */
3928
3962
  enabled?: boolean;
3929
- model?: "@cf/baai/bge-reranker-base" | "";
3963
+ model?: "@cf/baai/bge-reranker-base" | string;
3930
3964
  /** Match threshold (0-1, default 0.4) */
3931
3965
  match_threshold?: number;
3932
3966
  [key: string]: unknown;
@@ -3938,6 +3972,7 @@ type AiSearchChatCompletionsRequest = {
3938
3972
  messages: Array<{
3939
3973
  role: "system" | "developer" | "user" | "assistant" | "tool";
3940
3974
  content: string | null;
3975
+ [key: string]: unknown;
3941
3976
  }>;
3942
3977
  model?: string;
3943
3978
  stream?: boolean;
@@ -3958,7 +3993,7 @@ type AiSearchChatCompletionsRequest = {
3958
3993
  };
3959
3994
  reranking?: {
3960
3995
  enabled?: boolean;
3961
- model?: "@cf/baai/bge-reranker-base" | "";
3996
+ model?: "@cf/baai/bge-reranker-base" | string;
3962
3997
  match_threshold?: number;
3963
3998
  [key: string]: unknown;
3964
3999
  };
@@ -3966,7 +4001,7 @@ type AiSearchChatCompletionsRequest = {
3966
4001
  };
3967
4002
  [key: string]: unknown;
3968
4003
  };
3969
- // AI Search V2 Response Types
4004
+ // ============ AI Search Response Types ============
3970
4005
  type AiSearchSearchResponse = {
3971
4006
  search_query: string;
3972
4007
  chunks: Array<{
@@ -3985,26 +4020,65 @@ type AiSearchSearchResponse = {
3985
4020
  keyword_score?: number;
3986
4021
  /** Vector similarity score (0-1) */
3987
4022
  vector_score?: number;
4023
+ [key: string]: unknown;
3988
4024
  };
3989
4025
  }>;
3990
4026
  };
3991
- type AiSearchListResponse = Array<{
4027
+ type AiSearchChatCompletionsResponse = {
4028
+ id?: string;
4029
+ object?: string;
4030
+ model?: string;
4031
+ choices: Array<{
4032
+ index?: number;
4033
+ message: {
4034
+ role: "system" | "developer" | "user" | "assistant" | "tool";
4035
+ content: string | null;
4036
+ [key: string]: unknown;
4037
+ };
4038
+ [key: string]: unknown;
4039
+ }>;
4040
+ chunks: AiSearchSearchResponse["chunks"];
4041
+ [key: string]: unknown;
4042
+ };
4043
+ type AiSearchStatsResponse = {
4044
+ queued?: number;
4045
+ running?: number;
4046
+ completed?: number;
4047
+ error?: number;
4048
+ skipped?: number;
4049
+ outdated?: number;
4050
+ last_activity?: string;
4051
+ };
4052
+ // ============ AI Search Instance Info Types ============
4053
+ type AiSearchInstanceInfo = {
3992
4054
  id: string;
3993
- internal_id?: string;
3994
- account_id?: string;
3995
- account_tag?: string;
3996
- /** Whether the instance is enabled (default true) */
3997
- enable?: boolean;
3998
- type?: "r2" | "web-crawler";
4055
+ type?: "r2" | "web-crawler" | string;
3999
4056
  source?: string;
4057
+ paused?: boolean;
4058
+ status?: string;
4059
+ namespace?: string;
4060
+ created_at?: string;
4061
+ modified_at?: string;
4000
4062
  [key: string]: unknown;
4001
- }>;
4063
+ };
4064
+ type AiSearchListResponse = {
4065
+ result: AiSearchInstanceInfo[];
4066
+ result_info?: {
4067
+ count: number;
4068
+ page: number;
4069
+ per_page: number;
4070
+ total_count: number;
4071
+ };
4072
+ };
4073
+ // ============ AI Search Config Types ============
4002
4074
  type AiSearchConfig = {
4003
4075
  /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
4004
4076
  id: string;
4005
- type: "r2" | "web-crawler";
4006
- source: string;
4007
- source_params?: object;
4077
+ /** Instance type. Omit to create with built-in storage. */
4078
+ type?: "r2" | "web-crawler" | string;
4079
+ /** Source URL (required for web-crawler type). */
4080
+ source?: string;
4081
+ source_params?: unknown;
4008
4082
  /** Token ID (UUID format) */
4009
4083
  token_id?: string;
4010
4084
  ai_gateway_id?: string;
@@ -4014,54 +4088,307 @@ type AiSearchConfig = {
4014
4088
  reranking?: boolean;
4015
4089
  embedding_model?: string;
4016
4090
  ai_search_model?: string;
4091
+ [key: string]: unknown;
4017
4092
  };
4018
- type AiSearchInstance = {
4093
+ // ============ AI Search Item Types ============
4094
+ type AiSearchItemInfo = {
4019
4095
  id: string;
4020
- enable?: boolean;
4021
- type?: "r2" | "web-crawler";
4022
- source?: string;
4096
+ key: string;
4097
+ status:
4098
+ | "completed"
4099
+ | "error"
4100
+ | "skipped"
4101
+ | "queued"
4102
+ | "processing"
4103
+ | "outdated";
4104
+ metadata?: Record<string, unknown>;
4023
4105
  [key: string]: unknown;
4024
4106
  };
4025
- // AI Search Instance Service - Instance-level operations
4026
- declare abstract class AiSearchInstanceService {
4107
+ type AiSearchItemContentResult = {
4108
+ body: ReadableStream;
4109
+ contentType: string;
4110
+ filename: string;
4111
+ size: number;
4112
+ };
4113
+ type AiSearchUploadItemOptions = {
4114
+ metadata?: Record<string, unknown>;
4115
+ };
4116
+ type AiSearchListItemsParams = {
4117
+ page?: number;
4118
+ per_page?: number;
4119
+ };
4120
+ type AiSearchListItemsResponse = {
4121
+ result: AiSearchItemInfo[];
4122
+ result_info?: {
4123
+ count: number;
4124
+ page: number;
4125
+ per_page: number;
4126
+ total_count: number;
4127
+ };
4128
+ };
4129
+ // ============ AI Search Job Types ============
4130
+ type AiSearchJobInfo = {
4131
+ id: string;
4132
+ source: "user" | "schedule";
4133
+ description?: string;
4134
+ last_seen_at?: string;
4135
+ started_at?: string;
4136
+ ended_at?: string;
4137
+ end_reason?: string;
4138
+ };
4139
+ type AiSearchJobLog = {
4140
+ id: number;
4141
+ message: string;
4142
+ message_type: number;
4143
+ created_at: number;
4144
+ };
4145
+ type AiSearchCreateJobParams = {
4146
+ description?: string;
4147
+ };
4148
+ type AiSearchListJobsParams = {
4149
+ page?: number;
4150
+ per_page?: number;
4151
+ };
4152
+ type AiSearchListJobsResponse = {
4153
+ result: AiSearchJobInfo[];
4154
+ result_info?: {
4155
+ count: number;
4156
+ page: number;
4157
+ per_page: number;
4158
+ total_count: number;
4159
+ };
4160
+ };
4161
+ type AiSearchJobLogsParams = {
4162
+ page?: number;
4163
+ per_page?: number;
4164
+ };
4165
+ type AiSearchJobLogsResponse = {
4166
+ result: AiSearchJobLog[];
4167
+ result_info?: {
4168
+ count: number;
4169
+ page: number;
4170
+ per_page: number;
4171
+ total_count: number;
4172
+ };
4173
+ };
4174
+ // ============ AI Search Sub-Service Classes ============
4175
+ /**
4176
+ * Single item service for an AI Search instance.
4177
+ * Provides info, delete, and download operations on a specific item.
4178
+ */
4179
+ declare abstract class AiSearchItem {
4180
+ /** Get metadata about this item. */
4181
+ info(): Promise<AiSearchItemInfo>;
4182
+ /**
4183
+ * Download the item's content.
4184
+ * @returns Object with body stream, content type, filename, and size.
4185
+ */
4186
+ download(): Promise<AiSearchItemContentResult>;
4187
+ }
4188
+ /**
4189
+ * Items collection service for an AI Search instance.
4190
+ * Provides list, upload, and access to individual items.
4191
+ */
4192
+ declare abstract class AiSearchItems {
4193
+ /** List items in this instance. */
4194
+ list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
4195
+ /**
4196
+ * Upload a file as an item.
4197
+ * @param name Filename for the uploaded item.
4198
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4199
+ * @param options Optional metadata to attach to the item.
4200
+ * @returns The created item info.
4201
+ */
4202
+ upload(
4203
+ name: string,
4204
+ content: ReadableStream | ArrayBuffer | string,
4205
+ options?: AiSearchUploadItemOptions,
4206
+ ): Promise<AiSearchItemInfo>;
4207
+ /**
4208
+ * Upload a file and poll until processing completes.
4209
+ * @param name Filename for the uploaded item.
4210
+ * @param content File content as a ReadableStream, ArrayBuffer, or string.
4211
+ * @param options Optional metadata to attach to the item.
4212
+ * @returns The item info after processing completes (or timeout).
4213
+ */
4214
+ uploadAndPoll(
4215
+ name: string,
4216
+ content: ReadableStream | ArrayBuffer | string,
4217
+ options?: AiSearchUploadItemOptions,
4218
+ ): Promise<AiSearchItemInfo>;
4219
+ /**
4220
+ * Get an item by ID.
4221
+ * @param itemId The item identifier.
4222
+ * @returns Item service for info, delete, and download operations.
4223
+ */
4224
+ get(itemId: string): AiSearchItem;
4225
+ /** Delete this item from the instance.
4226
+ * @param itemId The item identifier.
4227
+ */
4228
+ delete(itemId: string): Promise<void>;
4229
+ }
4230
+ /**
4231
+ * Single job service for an AI Search instance.
4232
+ * Provides info and logs for a specific job.
4233
+ */
4234
+ declare abstract class AiSearchJob {
4235
+ /** Get metadata about this job. */
4236
+ info(): Promise<AiSearchJobInfo>;
4237
+ /** Get logs for this job. */
4238
+ logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
4239
+ }
4240
+ /**
4241
+ * Jobs collection service for an AI Search instance.
4242
+ * Provides list, create, and access to individual jobs.
4243
+ */
4244
+ declare abstract class AiSearchJobs {
4245
+ /** List jobs for this instance. */
4246
+ list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
4247
+ /**
4248
+ * Create a new indexing job.
4249
+ * @param params Optional job parameters.
4250
+ * @returns The created job info.
4251
+ */
4252
+ create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
4253
+ /**
4254
+ * Get a job by ID.
4255
+ * @param jobId The job identifier.
4256
+ * @returns Job service for info and logs operations.
4257
+ */
4258
+ get(jobId: string): AiSearchJob;
4259
+ }
4260
+ // ============ AI Search Binding Classes ============
4261
+ /**
4262
+ * Instance-level AI Search service.
4263
+ *
4264
+ * Used as:
4265
+ * - The return type of `AiSearchNamespace.get(name)` (namespace binding)
4266
+ * - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
4267
+ *
4268
+ * Provides search, chat, update, stats, items, and jobs operations.
4269
+ *
4270
+ * @example
4271
+ * ```ts
4272
+ * // Via namespace binding
4273
+ * const instance = env.AI_SEARCH.get("blog");
4274
+ * const results = await instance.search({
4275
+ * messages: [{ role: "user", content: "How does caching work?" }],
4276
+ * });
4277
+ *
4278
+ * // Via single instance binding
4279
+ * const results = await env.BLOG_SEARCH.search({
4280
+ * messages: [{ role: "user", content: "How does caching work?" }],
4281
+ * });
4282
+ * ```
4283
+ */
4284
+ declare abstract class AiSearchInstance {
4027
4285
  /**
4028
4286
  * Search the AI Search instance for relevant chunks.
4029
- * @param params Search request with messages and AI search options
4030
- * @returns Search response with matching chunks
4287
+ * @param params Search request with messages and optional AI search options.
4288
+ * @returns Search response with matching chunks and search query.
4031
4289
  */
4032
4290
  search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
4291
+ /**
4292
+ * Generate chat completions with AI Search context (streaming).
4293
+ * @param params Chat completions request with stream: true.
4294
+ * @returns ReadableStream of server-sent events.
4295
+ */
4296
+ chatCompletions(
4297
+ params: AiSearchChatCompletionsRequest & {
4298
+ stream: true;
4299
+ },
4300
+ ): Promise<ReadableStream>;
4033
4301
  /**
4034
4302
  * Generate chat completions with AI Search context.
4035
- * @param params Chat completions request with optional streaming
4036
- * @returns Response object (if streaming) or chat completion result
4303
+ * @param params Chat completions request.
4304
+ * @returns Chat completion response with choices and RAG chunks.
4037
4305
  */
4038
4306
  chatCompletions(
4039
4307
  params: AiSearchChatCompletionsRequest,
4040
- ): Promise<Response | object>;
4308
+ ): Promise<AiSearchChatCompletionsResponse>;
4041
4309
  /**
4042
- * Delete this AI Search instance.
4310
+ * Update the instance configuration.
4311
+ * @param config Partial configuration to update.
4312
+ * @returns Updated instance info.
4043
4313
  */
4044
- delete(): Promise<void>;
4314
+ update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
4315
+ /** Get metadata about this instance. */
4316
+ info(): Promise<AiSearchInstanceInfo>;
4317
+ /**
4318
+ * Get instance statistics (item count, indexing status, etc.).
4319
+ * @returns Statistics with counts per status and last activity time.
4320
+ */
4321
+ stats(): Promise<AiSearchStatsResponse>;
4322
+ /** Items collection — list, upload, and manage items in this instance. */
4323
+ get items(): AiSearchItems;
4324
+ /** Jobs collection — list, create, and inspect indexing jobs. */
4325
+ get jobs(): AiSearchJobs;
4045
4326
  }
4046
- // AI Search Account Service - Account-level operations
4047
- declare abstract class AiSearchAccountService {
4327
+ /**
4328
+ * Namespace-level AI Search service.
4329
+ *
4330
+ * Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
4331
+ * Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
4332
+ *
4333
+ * @example
4334
+ * ```ts
4335
+ * // Access an instance within the namespace
4336
+ * const blog = env.AI_SEARCH.get("blog");
4337
+ * const results = await blog.search({
4338
+ * messages: [{ role: "user", content: "How does caching work?" }],
4339
+ * });
4340
+ *
4341
+ * // List all instances in the namespace
4342
+ * const instances = await env.AI_SEARCH.list();
4343
+ *
4344
+ * // Create a new instance with built-in storage
4345
+ * const tenant = await env.AI_SEARCH.create({
4346
+ * id: "tenant-123",
4347
+ * });
4348
+ *
4349
+ * // Upload items into the instance
4350
+ * await tenant.items.upload("doc.pdf", fileContent);
4351
+ *
4352
+ * // Delete an instance
4353
+ * await env.AI_SEARCH.delete("tenant-123");
4354
+ * ```
4355
+ */
4356
+ declare abstract class AiSearchNamespace {
4048
4357
  /**
4049
- * List all AI Search instances in the account.
4050
- * @returns Array of AI Search instances
4358
+ * Get an instance by name within the bound namespace.
4359
+ * @param name Instance name.
4360
+ * @returns Instance service for search, chat, update, stats, items, and jobs.
4361
+ */
4362
+ get(name: string): AiSearchInstance;
4363
+ /**
4364
+ * List all instances in the bound namespace.
4365
+ * @returns Array of instance metadata.
4051
4366
  */
4052
4367
  list(): Promise<AiSearchListResponse>;
4053
4368
  /**
4054
- * Get an AI Search instance by ID.
4055
- * @param name Instance ID
4056
- * @returns Instance service for performing operations
4369
+ * Create a new instance within the bound namespace.
4370
+ * @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
4371
+ * @returns Instance service for the newly created instance.
4372
+ *
4373
+ * @example
4374
+ * ```ts
4375
+ * // Create with built-in storage (upload items manually)
4376
+ * const instance = await env.AI_SEARCH.create({ id: "my-search" });
4377
+ *
4378
+ * // Create with web crawler source
4379
+ * const instance = await env.AI_SEARCH.create({
4380
+ * id: "docs-search",
4381
+ * type: "web-crawler",
4382
+ * source: "https://developers.cloudflare.com",
4383
+ * });
4384
+ * ```
4057
4385
  */
4058
- get(name: string): AiSearchInstanceService;
4386
+ create(config: AiSearchConfig): Promise<AiSearchInstance>;
4059
4387
  /**
4060
- * Create a new AI Search instance.
4061
- * @param config Instance configuration
4062
- * @returns Instance service for performing operations
4388
+ * Delete an instance from the bound namespace.
4389
+ * @param name Instance name to delete.
4063
4390
  */
4064
- create(config: AiSearchConfig): Promise<AiSearchInstanceService>;
4391
+ delete(name: string): Promise<void>;
4065
4392
  }
4066
4393
  type AiImageClassificationInput = {
4067
4394
  image: number[];
@@ -10059,6 +10386,7 @@ type AiOptions = {
10059
10386
  returnRawResponse?: boolean;
10060
10387
  prefix?: string;
10061
10388
  extraHeaders?: object;
10389
+ signal?: AbortSignal;
10062
10390
  };
10063
10391
  type AiModelsSearchParams = {
10064
10392
  author?: string;
@@ -10102,46 +10430,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
10102
10430
  aiGatewayLogId: string | null;
10103
10431
  gateway(gatewayId: string): AiGateway;
10104
10432
  /**
10105
- * Access the AI Search API for managing AI-powered search instances.
10106
- *
10107
- * This is the new API that replaces AutoRAG with better namespace separation:
10108
- * - Account-level operations: `list()`, `create()`
10109
- * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
10110
- *
10111
- * @example
10112
- * ```typescript
10113
- * // List all AI Search instances
10114
- * const instances = await env.AI.aiSearch.list();
10115
- *
10116
- * // Search an instance
10117
- * const results = await env.AI.aiSearch.get('my-search').search({
10118
- * messages: [{ role: 'user', content: 'What is the policy?' }],
10119
- * ai_search_options: {
10120
- * retrieval: { max_num_results: 10 }
10121
- * }
10122
- * });
10123
- *
10124
- * // Generate chat completions with AI Search context
10125
- * const response = await env.AI.aiSearch.get('my-search').chatCompletions({
10126
- * messages: [{ role: 'user', content: 'What is the policy?' }],
10127
- * model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
10128
- * });
10129
- * ```
10433
+ * @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10434
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10130
10435
  */
10131
- aiSearch(): AiSearchAccountService;
10436
+ aiSearch(): AiSearchNamespace;
10132
10437
  /**
10133
10438
  * @deprecated AutoRAG has been replaced by AI Search.
10134
- * Use `env.AI.aiSearch` instead for better API design and new features.
10135
- *
10136
- * Migration guide:
10137
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
10138
- * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
10139
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
10439
+ * Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
10440
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10140
10441
  *
10141
- * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
10142
- *
10143
- * @see AiSearchAccountService
10144
- * @param autoragId Optional instance ID (omit for account-level operations)
10442
+ * @param autoragId Instance ID
10145
10443
  */
10146
10444
  autorag(autoragId: string): AutoRAG;
10147
10445
  run<
@@ -10300,22 +10598,23 @@ declare abstract class AiGateway {
10300
10598
  getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
10301
10599
  }
10302
10600
  /**
10303
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.
10304
- * @see AiSearchInternalError
10601
+ * @deprecated Use the standalone AI Search Workers binding instead.
10602
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10305
10603
  */
10306
10604
  interface AutoRAGInternalError extends Error {}
10307
10605
  /**
10308
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.
10309
- * @see AiSearchNotFoundError
10606
+ * @deprecated Use the standalone AI Search Workers binding instead.
10607
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10310
10608
  */
10311
10609
  interface AutoRAGNotFoundError extends Error {}
10312
10610
  /**
10313
- * @deprecated This error type is no longer used in the AI Search API.
10611
+ * @deprecated Use the standalone AI Search Workers binding instead.
10612
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10314
10613
  */
10315
10614
  interface AutoRAGUnauthorizedError extends Error {}
10316
10615
  /**
10317
- * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.
10318
- * @see AiSearchNameNotSetError
10616
+ * @deprecated Use the standalone AI Search Workers binding instead.
10617
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10319
10618
  */
10320
10619
  interface AutoRAGNameNotSetError extends Error {}
10321
10620
  type ComparisonFilter = {
@@ -10328,9 +10627,8 @@ type CompoundFilter = {
10328
10627
  filters: ComparisonFilter[];
10329
10628
  };
10330
10629
  /**
10331
- * @deprecated AutoRAG has been replaced by AI Search.
10332
- * Use AiSearchSearchRequest with the new API instead.
10333
- * @see AiSearchSearchRequest
10630
+ * @deprecated Use the standalone AI Search Workers binding instead.
10631
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10334
10632
  */
10335
10633
  type AutoRagSearchRequest = {
10336
10634
  query: string;
@@ -10347,18 +10645,16 @@ type AutoRagSearchRequest = {
10347
10645
  rewrite_query?: boolean;
10348
10646
  };
10349
10647
  /**
10350
- * @deprecated AutoRAG has been replaced by AI Search.
10351
- * Use AiSearchChatCompletionsRequest with the new API instead.
10352
- * @see AiSearchChatCompletionsRequest
10648
+ * @deprecated Use the standalone AI Search Workers binding instead.
10649
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10353
10650
  */
10354
10651
  type AutoRagAiSearchRequest = AutoRagSearchRequest & {
10355
10652
  stream?: boolean;
10356
10653
  system_prompt?: string;
10357
10654
  };
10358
10655
  /**
10359
- * @deprecated AutoRAG has been replaced by AI Search.
10360
- * Use AiSearchChatCompletionsRequest with stream: true instead.
10361
- * @see AiSearchChatCompletionsRequest
10656
+ * @deprecated Use the standalone AI Search Workers binding instead.
10657
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10362
10658
  */
10363
10659
  type AutoRagAiSearchRequestStreaming = Omit<
10364
10660
  AutoRagAiSearchRequest,
@@ -10367,9 +10663,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
10367
10663
  stream: true;
10368
10664
  };
10369
10665
  /**
10370
- * @deprecated AutoRAG has been replaced by AI Search.
10371
- * Use AiSearchSearchResponse with the new API instead.
10372
- * @see AiSearchSearchResponse
10666
+ * @deprecated Use the standalone AI Search Workers binding instead.
10667
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10373
10668
  */
10374
10669
  type AutoRagSearchResponse = {
10375
10670
  object: "vector_store.search_results.page";
@@ -10388,9 +10683,8 @@ type AutoRagSearchResponse = {
10388
10683
  next_page: string | null;
10389
10684
  };
10390
10685
  /**
10391
- * @deprecated AutoRAG has been replaced by AI Search.
10392
- * Use AiSearchListResponse with the new API instead.
10393
- * @see AiSearchListResponse
10686
+ * @deprecated Use the standalone AI Search Workers binding instead.
10687
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10394
10688
  */
10395
10689
  type AutoRagListResponse = {
10396
10690
  id: string;
@@ -10402,49 +10696,40 @@ type AutoRagListResponse = {
10402
10696
  status: string;
10403
10697
  }[];
10404
10698
  /**
10405
- * @deprecated AutoRAG has been replaced by AI Search.
10406
- * The new API returns different response formats for chat completions.
10699
+ * @deprecated Use the standalone AI Search Workers binding instead.
10700
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10407
10701
  */
10408
10702
  type AutoRagAiSearchResponse = AutoRagSearchResponse & {
10409
10703
  response: string;
10410
10704
  };
10411
10705
  /**
10412
- * @deprecated AutoRAG has been replaced by AI Search.
10413
- * Use the new AI Search API instead: `env.AI.aiSearch`
10414
- *
10415
- * Migration guide:
10416
- * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
10417
- * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
10418
- * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
10419
- *
10420
- * @see AiSearchAccountService
10421
- * @see AiSearchInstanceService
10706
+ * @deprecated Use the standalone AI Search Workers binding instead.
10707
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10422
10708
  */
10423
10709
  declare abstract class AutoRAG {
10424
10710
  /**
10425
- * @deprecated Use `env.AI.aiSearch.list()` instead.
10426
- * @see AiSearchAccountService.list
10711
+ * @deprecated Use the standalone AI Search Workers binding instead.
10712
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10427
10713
  */
10428
10714
  list(): Promise<AutoRagListResponse>;
10429
10715
  /**
10430
- * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.
10431
- * Note: The new API uses a messages array instead of a query string.
10432
- * @see AiSearchInstanceService.search
10716
+ * @deprecated Use the standalone AI Search Workers binding instead.
10717
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10433
10718
  */
10434
10719
  search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
10435
10720
  /**
10436
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
10437
- * @see AiSearchInstanceService.chatCompletions
10721
+ * @deprecated Use the standalone AI Search Workers binding instead.
10722
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10438
10723
  */
10439
10724
  aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
10440
10725
  /**
10441
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
10442
- * @see AiSearchInstanceService.chatCompletions
10726
+ * @deprecated Use the standalone AI Search Workers binding instead.
10727
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10443
10728
  */
10444
10729
  aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
10445
10730
  /**
10446
- * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.
10447
- * @see AiSearchInstanceService.chatCompletions
10731
+ * @deprecated Use the standalone AI Search Workers binding instead.
10732
+ * See https://developers.cloudflare.com/ai-search/usage/workers-binding/
10448
10733
  */
10449
10734
  aiSearch(
10450
10735
  params: AutoRagAiSearchRequest,
@@ -13024,14 +13309,13 @@ interface StreamScopedCaptions {
13024
13309
  * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
13025
13310
  * One caption or subtitle file per language is allowed.
13026
13311
  * @param language The BCP 47 language tag for the caption or subtitle.
13027
- * @param file The caption or subtitle file to upload.
13312
+ * @param input The caption or subtitle stream to upload.
13028
13313
  * @returns The created caption entry.
13029
13314
  * @throws {NotFoundError} if the video is not found
13030
13315
  * @throws {BadRequestError} if the language or file is invalid
13031
- * @throws {MaxFileSizeError} if the file size is too large
13032
13316
  * @throws {InternalError} if an unexpected error occurs
13033
13317
  */
13034
- upload(language: string, file: File): Promise<StreamCaption>;
13318
+ upload(language: string, input: ReadableStream): Promise<StreamCaption>;
13035
13319
  /**
13036
13320
  * Generate captions or subtitles for the provided language via AI.
13037
13321
  * @param language The BCP 47 language tag to generate.
@@ -13107,17 +13391,16 @@ interface StreamVideos {
13107
13391
  interface StreamWatermarks {
13108
13392
  /**
13109
13393
  * Generate a new watermark profile
13110
- * @param file The image file to upload
13394
+ * @param input The image stream to upload
13111
13395
  * @param params The watermark creation parameters.
13112
13396
  * @returns The created watermark profile.
13113
13397
  * @throws {BadRequestError} if the parameters are invalid
13114
13398
  * @throws {InvalidURLError} if the URL is invalid
13115
- * @throws {MaxFileSizeError} if the file size is too large
13116
13399
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13117
13400
  * @throws {InternalError} if an unexpected error occurs
13118
13401
  */
13119
13402
  generate(
13120
- file: File,
13403
+ input: ReadableStream,
13121
13404
  params: StreamWatermarkCreateParams,
13122
13405
  ): Promise<StreamWatermark>;
13123
13406
  /**
@@ -13127,7 +13410,6 @@ interface StreamWatermarks {
13127
13410
  * @returns The created watermark profile.
13128
13411
  * @throws {BadRequestError} if the parameters are invalid
13129
13412
  * @throws {InvalidURLError} if the URL is invalid
13130
- * @throws {MaxFileSizeError} if the file size is too large
13131
13413
  * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
13132
13414
  * @throws {InternalError} if an unexpected error occurs
13133
13415
  */