@cloudflare/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.
- package/2021-11-03/index.d.ts +413 -131
- package/2021-11-03/index.ts +413 -131
- package/2022-01-31/index.d.ts +413 -131
- package/2022-01-31/index.ts +413 -131
- package/2022-03-21/index.d.ts +413 -131
- package/2022-03-21/index.ts +413 -131
- package/2022-08-04/index.d.ts +413 -131
- package/2022-08-04/index.ts +413 -131
- package/2022-10-31/index.d.ts +413 -131
- package/2022-10-31/index.ts +413 -131
- package/2022-11-30/index.d.ts +413 -131
- package/2022-11-30/index.ts +413 -131
- package/2023-03-01/index.d.ts +413 -131
- package/2023-03-01/index.ts +413 -131
- package/2023-07-01/index.d.ts +413 -131
- package/2023-07-01/index.ts +413 -131
- package/experimental/index.d.ts +398 -134
- package/experimental/index.ts +398 -134
- package/index.d.ts +413 -131
- package/index.ts +413 -131
- package/latest/index.d.ts +413 -131
- package/latest/index.ts +413 -131
- package/oldest/index.d.ts +413 -131
- package/oldest/index.ts +413 -131
- package/package.json +1 -1
package/latest/index.ts
CHANGED
|
@@ -3121,6 +3121,11 @@ export interface QueuingStrategyInit {
|
|
|
3121
3121
|
*/
|
|
3122
3122
|
highWaterMark: number;
|
|
3123
3123
|
}
|
|
3124
|
+
export interface TracePreviewInfo {
|
|
3125
|
+
id: string;
|
|
3126
|
+
slug: string;
|
|
3127
|
+
name: string;
|
|
3128
|
+
}
|
|
3124
3129
|
export interface ScriptVersion {
|
|
3125
3130
|
id?: string;
|
|
3126
3131
|
tag?: string;
|
|
@@ -3155,6 +3160,7 @@ export interface TraceItem {
|
|
|
3155
3160
|
readonly dispatchNamespace?: string;
|
|
3156
3161
|
readonly scriptTags?: string[];
|
|
3157
3162
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3163
|
+
readonly preview?: TracePreviewInfo;
|
|
3158
3164
|
readonly durableObjectId?: string;
|
|
3159
3165
|
readonly outcome: string;
|
|
3160
3166
|
readonly executionModel: string;
|
|
@@ -3782,12 +3788,42 @@ export interface Container {
|
|
|
3782
3788
|
setInactivityTimeout(durationMs: number | bigint): Promise<void>;
|
|
3783
3789
|
interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;
|
|
3784
3790
|
interceptAllOutboundHttp(binding: Fetcher): Promise<void>;
|
|
3791
|
+
snapshotDirectory(
|
|
3792
|
+
options: ContainerDirectorySnapshotOptions,
|
|
3793
|
+
): Promise<ContainerDirectorySnapshot>;
|
|
3794
|
+
snapshotContainer(
|
|
3795
|
+
options: ContainerSnapshotOptions,
|
|
3796
|
+
): Promise<ContainerSnapshot>;
|
|
3797
|
+
}
|
|
3798
|
+
export interface ContainerDirectorySnapshot {
|
|
3799
|
+
id: string;
|
|
3800
|
+
size: number;
|
|
3801
|
+
dir: string;
|
|
3802
|
+
name?: string;
|
|
3803
|
+
}
|
|
3804
|
+
export interface ContainerDirectorySnapshotOptions {
|
|
3805
|
+
dir: string;
|
|
3806
|
+
name?: string;
|
|
3807
|
+
}
|
|
3808
|
+
export interface ContainerDirectorySnapshotRestoreParams {
|
|
3809
|
+
snapshot: ContainerDirectorySnapshot;
|
|
3810
|
+
mountPoint?: string;
|
|
3811
|
+
}
|
|
3812
|
+
export interface ContainerSnapshot {
|
|
3813
|
+
id: string;
|
|
3814
|
+
size: number;
|
|
3815
|
+
name?: string;
|
|
3816
|
+
}
|
|
3817
|
+
export interface ContainerSnapshotOptions {
|
|
3818
|
+
name?: string;
|
|
3785
3819
|
}
|
|
3786
3820
|
export interface ContainerStartupOptions {
|
|
3787
3821
|
entrypoint?: string[];
|
|
3788
3822
|
enableInternet: boolean;
|
|
3789
3823
|
env?: Record<string, string>;
|
|
3790
3824
|
labels?: Record<string, string>;
|
|
3825
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3826
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3791
3827
|
}
|
|
3792
3828
|
/**
|
|
3793
3829
|
* 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.
|
|
@@ -3934,11 +3970,10 @@ export declare abstract class Performance {
|
|
|
3934
3970
|
*/
|
|
3935
3971
|
toJSON(): object;
|
|
3936
3972
|
}
|
|
3937
|
-
// AI Search
|
|
3973
|
+
// ============ AI Search Error Interfaces ============
|
|
3938
3974
|
export interface AiSearchInternalError extends Error {}
|
|
3939
3975
|
export interface AiSearchNotFoundError extends Error {}
|
|
3940
|
-
|
|
3941
|
-
// AI Search V2 Request Types
|
|
3976
|
+
// ============ AI Search Request Types ============
|
|
3942
3977
|
export type AiSearchSearchRequest = {
|
|
3943
3978
|
messages: Array<{
|
|
3944
3979
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3963,9 +3998,8 @@ export type AiSearchSearchRequest = {
|
|
|
3963
3998
|
[key: string]: unknown;
|
|
3964
3999
|
};
|
|
3965
4000
|
reranking?: {
|
|
3966
|
-
/** Enable reranking (default false) */
|
|
3967
4001
|
enabled?: boolean;
|
|
3968
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4002
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3969
4003
|
/** Match threshold (0-1, default 0.4) */
|
|
3970
4004
|
match_threshold?: number;
|
|
3971
4005
|
[key: string]: unknown;
|
|
@@ -3977,6 +4011,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3977
4011
|
messages: Array<{
|
|
3978
4012
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3979
4013
|
content: string | null;
|
|
4014
|
+
[key: string]: unknown;
|
|
3980
4015
|
}>;
|
|
3981
4016
|
model?: string;
|
|
3982
4017
|
stream?: boolean;
|
|
@@ -3997,7 +4032,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
3997
4032
|
};
|
|
3998
4033
|
reranking?: {
|
|
3999
4034
|
enabled?: boolean;
|
|
4000
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4035
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
4001
4036
|
match_threshold?: number;
|
|
4002
4037
|
[key: string]: unknown;
|
|
4003
4038
|
};
|
|
@@ -4005,7 +4040,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
4005
4040
|
};
|
|
4006
4041
|
[key: string]: unknown;
|
|
4007
4042
|
};
|
|
4008
|
-
// AI Search
|
|
4043
|
+
// ============ AI Search Response Types ============
|
|
4009
4044
|
export type AiSearchSearchResponse = {
|
|
4010
4045
|
search_query: string;
|
|
4011
4046
|
chunks: Array<{
|
|
@@ -4024,26 +4059,65 @@ export type AiSearchSearchResponse = {
|
|
|
4024
4059
|
keyword_score?: number;
|
|
4025
4060
|
/** Vector similarity score (0-1) */
|
|
4026
4061
|
vector_score?: number;
|
|
4062
|
+
[key: string]: unknown;
|
|
4027
4063
|
};
|
|
4028
4064
|
}>;
|
|
4029
4065
|
};
|
|
4030
|
-
export type
|
|
4066
|
+
export type AiSearchChatCompletionsResponse = {
|
|
4067
|
+
id?: string;
|
|
4068
|
+
object?: string;
|
|
4069
|
+
model?: string;
|
|
4070
|
+
choices: Array<{
|
|
4071
|
+
index?: number;
|
|
4072
|
+
message: {
|
|
4073
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4074
|
+
content: string | null;
|
|
4075
|
+
[key: string]: unknown;
|
|
4076
|
+
};
|
|
4077
|
+
[key: string]: unknown;
|
|
4078
|
+
}>;
|
|
4079
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4080
|
+
[key: string]: unknown;
|
|
4081
|
+
};
|
|
4082
|
+
export type AiSearchStatsResponse = {
|
|
4083
|
+
queued?: number;
|
|
4084
|
+
running?: number;
|
|
4085
|
+
completed?: number;
|
|
4086
|
+
error?: number;
|
|
4087
|
+
skipped?: number;
|
|
4088
|
+
outdated?: number;
|
|
4089
|
+
last_activity?: string;
|
|
4090
|
+
};
|
|
4091
|
+
// ============ AI Search Instance Info Types ============
|
|
4092
|
+
export type AiSearchInstanceInfo = {
|
|
4031
4093
|
id: string;
|
|
4032
|
-
|
|
4033
|
-
account_id?: string;
|
|
4034
|
-
account_tag?: string;
|
|
4035
|
-
/** Whether the instance is enabled (default true) */
|
|
4036
|
-
enable?: boolean;
|
|
4037
|
-
type?: "r2" | "web-crawler";
|
|
4094
|
+
type?: "r2" | "web-crawler" | string;
|
|
4038
4095
|
source?: string;
|
|
4096
|
+
paused?: boolean;
|
|
4097
|
+
status?: string;
|
|
4098
|
+
namespace?: string;
|
|
4099
|
+
created_at?: string;
|
|
4100
|
+
modified_at?: string;
|
|
4039
4101
|
[key: string]: unknown;
|
|
4040
|
-
}
|
|
4102
|
+
};
|
|
4103
|
+
export type AiSearchListResponse = {
|
|
4104
|
+
result: AiSearchInstanceInfo[];
|
|
4105
|
+
result_info?: {
|
|
4106
|
+
count: number;
|
|
4107
|
+
page: number;
|
|
4108
|
+
per_page: number;
|
|
4109
|
+
total_count: number;
|
|
4110
|
+
};
|
|
4111
|
+
};
|
|
4112
|
+
// ============ AI Search Config Types ============
|
|
4041
4113
|
export type AiSearchConfig = {
|
|
4042
4114
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4043
4115
|
id: string;
|
|
4044
|
-
type
|
|
4045
|
-
|
|
4046
|
-
|
|
4116
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4117
|
+
type?: "r2" | "web-crawler" | string;
|
|
4118
|
+
/** Source URL (required for web-crawler type). */
|
|
4119
|
+
source?: string;
|
|
4120
|
+
source_params?: unknown;
|
|
4047
4121
|
/** Token ID (UUID format) */
|
|
4048
4122
|
token_id?: string;
|
|
4049
4123
|
ai_gateway_id?: string;
|
|
@@ -4053,54 +4127,307 @@ export type AiSearchConfig = {
|
|
|
4053
4127
|
reranking?: boolean;
|
|
4054
4128
|
embedding_model?: string;
|
|
4055
4129
|
ai_search_model?: string;
|
|
4130
|
+
[key: string]: unknown;
|
|
4056
4131
|
};
|
|
4057
|
-
|
|
4132
|
+
// ============ AI Search Item Types ============
|
|
4133
|
+
export type AiSearchItemInfo = {
|
|
4058
4134
|
id: string;
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4135
|
+
key: string;
|
|
4136
|
+
status:
|
|
4137
|
+
| "completed"
|
|
4138
|
+
| "error"
|
|
4139
|
+
| "skipped"
|
|
4140
|
+
| "queued"
|
|
4141
|
+
| "processing"
|
|
4142
|
+
| "outdated";
|
|
4143
|
+
metadata?: Record<string, unknown>;
|
|
4062
4144
|
[key: string]: unknown;
|
|
4063
4145
|
};
|
|
4064
|
-
|
|
4065
|
-
|
|
4146
|
+
export type AiSearchItemContentResult = {
|
|
4147
|
+
body: ReadableStream;
|
|
4148
|
+
contentType: string;
|
|
4149
|
+
filename: string;
|
|
4150
|
+
size: number;
|
|
4151
|
+
};
|
|
4152
|
+
export type AiSearchUploadItemOptions = {
|
|
4153
|
+
metadata?: Record<string, unknown>;
|
|
4154
|
+
};
|
|
4155
|
+
export type AiSearchListItemsParams = {
|
|
4156
|
+
page?: number;
|
|
4157
|
+
per_page?: number;
|
|
4158
|
+
};
|
|
4159
|
+
export type AiSearchListItemsResponse = {
|
|
4160
|
+
result: AiSearchItemInfo[];
|
|
4161
|
+
result_info?: {
|
|
4162
|
+
count: number;
|
|
4163
|
+
page: number;
|
|
4164
|
+
per_page: number;
|
|
4165
|
+
total_count: number;
|
|
4166
|
+
};
|
|
4167
|
+
};
|
|
4168
|
+
// ============ AI Search Job Types ============
|
|
4169
|
+
export type AiSearchJobInfo = {
|
|
4170
|
+
id: string;
|
|
4171
|
+
source: "user" | "schedule";
|
|
4172
|
+
description?: string;
|
|
4173
|
+
last_seen_at?: string;
|
|
4174
|
+
started_at?: string;
|
|
4175
|
+
ended_at?: string;
|
|
4176
|
+
end_reason?: string;
|
|
4177
|
+
};
|
|
4178
|
+
export type AiSearchJobLog = {
|
|
4179
|
+
id: number;
|
|
4180
|
+
message: string;
|
|
4181
|
+
message_type: number;
|
|
4182
|
+
created_at: number;
|
|
4183
|
+
};
|
|
4184
|
+
export type AiSearchCreateJobParams = {
|
|
4185
|
+
description?: string;
|
|
4186
|
+
};
|
|
4187
|
+
export type AiSearchListJobsParams = {
|
|
4188
|
+
page?: number;
|
|
4189
|
+
per_page?: number;
|
|
4190
|
+
};
|
|
4191
|
+
export type AiSearchListJobsResponse = {
|
|
4192
|
+
result: AiSearchJobInfo[];
|
|
4193
|
+
result_info?: {
|
|
4194
|
+
count: number;
|
|
4195
|
+
page: number;
|
|
4196
|
+
per_page: number;
|
|
4197
|
+
total_count: number;
|
|
4198
|
+
};
|
|
4199
|
+
};
|
|
4200
|
+
export type AiSearchJobLogsParams = {
|
|
4201
|
+
page?: number;
|
|
4202
|
+
per_page?: number;
|
|
4203
|
+
};
|
|
4204
|
+
export type AiSearchJobLogsResponse = {
|
|
4205
|
+
result: AiSearchJobLog[];
|
|
4206
|
+
result_info?: {
|
|
4207
|
+
count: number;
|
|
4208
|
+
page: number;
|
|
4209
|
+
per_page: number;
|
|
4210
|
+
total_count: number;
|
|
4211
|
+
};
|
|
4212
|
+
};
|
|
4213
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4214
|
+
/**
|
|
4215
|
+
* Single item service for an AI Search instance.
|
|
4216
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4217
|
+
*/
|
|
4218
|
+
export declare abstract class AiSearchItem {
|
|
4219
|
+
/** Get metadata about this item. */
|
|
4220
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4221
|
+
/**
|
|
4222
|
+
* Download the item's content.
|
|
4223
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4224
|
+
*/
|
|
4225
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4226
|
+
}
|
|
4227
|
+
/**
|
|
4228
|
+
* Items collection service for an AI Search instance.
|
|
4229
|
+
* Provides list, upload, and access to individual items.
|
|
4230
|
+
*/
|
|
4231
|
+
export declare abstract class AiSearchItems {
|
|
4232
|
+
/** List items in this instance. */
|
|
4233
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4234
|
+
/**
|
|
4235
|
+
* Upload a file as an item.
|
|
4236
|
+
* @param name Filename for the uploaded item.
|
|
4237
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4238
|
+
* @param options Optional metadata to attach to the item.
|
|
4239
|
+
* @returns The created item info.
|
|
4240
|
+
*/
|
|
4241
|
+
upload(
|
|
4242
|
+
name: string,
|
|
4243
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4244
|
+
options?: AiSearchUploadItemOptions,
|
|
4245
|
+
): Promise<AiSearchItemInfo>;
|
|
4246
|
+
/**
|
|
4247
|
+
* Upload a file and poll until processing completes.
|
|
4248
|
+
* @param name Filename for the uploaded item.
|
|
4249
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4250
|
+
* @param options Optional metadata to attach to the item.
|
|
4251
|
+
* @returns The item info after processing completes (or timeout).
|
|
4252
|
+
*/
|
|
4253
|
+
uploadAndPoll(
|
|
4254
|
+
name: string,
|
|
4255
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4256
|
+
options?: AiSearchUploadItemOptions,
|
|
4257
|
+
): Promise<AiSearchItemInfo>;
|
|
4258
|
+
/**
|
|
4259
|
+
* Get an item by ID.
|
|
4260
|
+
* @param itemId The item identifier.
|
|
4261
|
+
* @returns Item service for info, delete, and download operations.
|
|
4262
|
+
*/
|
|
4263
|
+
get(itemId: string): AiSearchItem;
|
|
4264
|
+
/** Delete this item from the instance.
|
|
4265
|
+
* @param itemId The item identifier.
|
|
4266
|
+
*/
|
|
4267
|
+
delete(itemId: string): Promise<void>;
|
|
4268
|
+
}
|
|
4269
|
+
/**
|
|
4270
|
+
* Single job service for an AI Search instance.
|
|
4271
|
+
* Provides info and logs for a specific job.
|
|
4272
|
+
*/
|
|
4273
|
+
export declare abstract class AiSearchJob {
|
|
4274
|
+
/** Get metadata about this job. */
|
|
4275
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4276
|
+
/** Get logs for this job. */
|
|
4277
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4278
|
+
}
|
|
4279
|
+
/**
|
|
4280
|
+
* Jobs collection service for an AI Search instance.
|
|
4281
|
+
* Provides list, create, and access to individual jobs.
|
|
4282
|
+
*/
|
|
4283
|
+
export declare abstract class AiSearchJobs {
|
|
4284
|
+
/** List jobs for this instance. */
|
|
4285
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4286
|
+
/**
|
|
4287
|
+
* Create a new indexing job.
|
|
4288
|
+
* @param params Optional job parameters.
|
|
4289
|
+
* @returns The created job info.
|
|
4290
|
+
*/
|
|
4291
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4292
|
+
/**
|
|
4293
|
+
* Get a job by ID.
|
|
4294
|
+
* @param jobId The job identifier.
|
|
4295
|
+
* @returns Job service for info and logs operations.
|
|
4296
|
+
*/
|
|
4297
|
+
get(jobId: string): AiSearchJob;
|
|
4298
|
+
}
|
|
4299
|
+
// ============ AI Search Binding Classes ============
|
|
4300
|
+
/**
|
|
4301
|
+
* Instance-level AI Search service.
|
|
4302
|
+
*
|
|
4303
|
+
* Used as:
|
|
4304
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4305
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4306
|
+
*
|
|
4307
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4308
|
+
*
|
|
4309
|
+
* @example
|
|
4310
|
+
* ```ts
|
|
4311
|
+
* // Via namespace binding
|
|
4312
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4313
|
+
* const results = await instance.search({
|
|
4314
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4315
|
+
* });
|
|
4316
|
+
*
|
|
4317
|
+
* // Via single instance binding
|
|
4318
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4319
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4320
|
+
* });
|
|
4321
|
+
* ```
|
|
4322
|
+
*/
|
|
4323
|
+
export declare abstract class AiSearchInstance {
|
|
4066
4324
|
/**
|
|
4067
4325
|
* Search the AI Search instance for relevant chunks.
|
|
4068
|
-
* @param params Search request with messages and AI search options
|
|
4069
|
-
* @returns Search response with matching chunks
|
|
4326
|
+
* @param params Search request with messages and optional AI search options.
|
|
4327
|
+
* @returns Search response with matching chunks and search query.
|
|
4070
4328
|
*/
|
|
4071
4329
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4330
|
+
/**
|
|
4331
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4332
|
+
* @param params Chat completions request with stream: true.
|
|
4333
|
+
* @returns ReadableStream of server-sent events.
|
|
4334
|
+
*/
|
|
4335
|
+
chatCompletions(
|
|
4336
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4337
|
+
stream: true;
|
|
4338
|
+
},
|
|
4339
|
+
): Promise<ReadableStream>;
|
|
4072
4340
|
/**
|
|
4073
4341
|
* Generate chat completions with AI Search context.
|
|
4074
|
-
* @param params Chat completions request
|
|
4075
|
-
* @returns
|
|
4342
|
+
* @param params Chat completions request.
|
|
4343
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4076
4344
|
*/
|
|
4077
4345
|
chatCompletions(
|
|
4078
4346
|
params: AiSearchChatCompletionsRequest,
|
|
4079
|
-
): Promise<
|
|
4347
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4080
4348
|
/**
|
|
4081
|
-
*
|
|
4349
|
+
* Update the instance configuration.
|
|
4350
|
+
* @param config Partial configuration to update.
|
|
4351
|
+
* @returns Updated instance info.
|
|
4082
4352
|
*/
|
|
4083
|
-
|
|
4353
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4354
|
+
/** Get metadata about this instance. */
|
|
4355
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4356
|
+
/**
|
|
4357
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4358
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4359
|
+
*/
|
|
4360
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4361
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4362
|
+
get items(): AiSearchItems;
|
|
4363
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4364
|
+
get jobs(): AiSearchJobs;
|
|
4084
4365
|
}
|
|
4085
|
-
|
|
4086
|
-
|
|
4366
|
+
/**
|
|
4367
|
+
* Namespace-level AI Search service.
|
|
4368
|
+
*
|
|
4369
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4370
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4371
|
+
*
|
|
4372
|
+
* @example
|
|
4373
|
+
* ```ts
|
|
4374
|
+
* // Access an instance within the namespace
|
|
4375
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4376
|
+
* const results = await blog.search({
|
|
4377
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4378
|
+
* });
|
|
4379
|
+
*
|
|
4380
|
+
* // List all instances in the namespace
|
|
4381
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4382
|
+
*
|
|
4383
|
+
* // Create a new instance with built-in storage
|
|
4384
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4385
|
+
* id: "tenant-123",
|
|
4386
|
+
* });
|
|
4387
|
+
*
|
|
4388
|
+
* // Upload items into the instance
|
|
4389
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4390
|
+
*
|
|
4391
|
+
* // Delete an instance
|
|
4392
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4393
|
+
* ```
|
|
4394
|
+
*/
|
|
4395
|
+
export declare abstract class AiSearchNamespace {
|
|
4087
4396
|
/**
|
|
4088
|
-
*
|
|
4089
|
-
* @
|
|
4397
|
+
* Get an instance by name within the bound namespace.
|
|
4398
|
+
* @param name Instance name.
|
|
4399
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4400
|
+
*/
|
|
4401
|
+
get(name: string): AiSearchInstance;
|
|
4402
|
+
/**
|
|
4403
|
+
* List all instances in the bound namespace.
|
|
4404
|
+
* @returns Array of instance metadata.
|
|
4090
4405
|
*/
|
|
4091
4406
|
list(): Promise<AiSearchListResponse>;
|
|
4092
4407
|
/**
|
|
4093
|
-
*
|
|
4094
|
-
* @param
|
|
4095
|
-
* @returns Instance service for
|
|
4408
|
+
* Create a new instance within the bound namespace.
|
|
4409
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4410
|
+
* @returns Instance service for the newly created instance.
|
|
4411
|
+
*
|
|
4412
|
+
* @example
|
|
4413
|
+
* ```ts
|
|
4414
|
+
* // Create with built-in storage (upload items manually)
|
|
4415
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4416
|
+
*
|
|
4417
|
+
* // Create with web crawler source
|
|
4418
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4419
|
+
* id: "docs-search",
|
|
4420
|
+
* type: "web-crawler",
|
|
4421
|
+
* source: "https://developers.cloudflare.com",
|
|
4422
|
+
* });
|
|
4423
|
+
* ```
|
|
4096
4424
|
*/
|
|
4097
|
-
|
|
4425
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4098
4426
|
/**
|
|
4099
|
-
*
|
|
4100
|
-
* @param
|
|
4101
|
-
* @returns Instance service for performing operations
|
|
4427
|
+
* Delete an instance from the bound namespace.
|
|
4428
|
+
* @param name Instance name to delete.
|
|
4102
4429
|
*/
|
|
4103
|
-
|
|
4430
|
+
delete(name: string): Promise<void>;
|
|
4104
4431
|
}
|
|
4105
4432
|
export type AiImageClassificationInput = {
|
|
4106
4433
|
image: number[];
|
|
@@ -10101,6 +10428,7 @@ export type AiOptions = {
|
|
|
10101
10428
|
returnRawResponse?: boolean;
|
|
10102
10429
|
prefix?: string;
|
|
10103
10430
|
extraHeaders?: object;
|
|
10431
|
+
signal?: AbortSignal;
|
|
10104
10432
|
};
|
|
10105
10433
|
export type AiModelsSearchParams = {
|
|
10106
10434
|
author?: string;
|
|
@@ -10146,46 +10474,16 @@ export declare abstract class Ai<
|
|
|
10146
10474
|
aiGatewayLogId: string | null;
|
|
10147
10475
|
gateway(gatewayId: string): AiGateway;
|
|
10148
10476
|
/**
|
|
10149
|
-
*
|
|
10150
|
-
*
|
|
10151
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10152
|
-
* - Account-level operations: `list()`, `create()`
|
|
10153
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10154
|
-
*
|
|
10155
|
-
* @example
|
|
10156
|
-
* ```typescript
|
|
10157
|
-
* // List all AI Search instances
|
|
10158
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10159
|
-
*
|
|
10160
|
-
* // Search an instance
|
|
10161
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10162
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10163
|
-
* ai_search_options: {
|
|
10164
|
-
* retrieval: { max_num_results: 10 }
|
|
10165
|
-
* }
|
|
10166
|
-
* });
|
|
10167
|
-
*
|
|
10168
|
-
* // Generate chat completions with AI Search context
|
|
10169
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10170
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10171
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10172
|
-
* });
|
|
10173
|
-
* ```
|
|
10477
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10478
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10174
10479
|
*/
|
|
10175
|
-
aiSearch():
|
|
10480
|
+
aiSearch(): AiSearchNamespace;
|
|
10176
10481
|
/**
|
|
10177
10482
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10178
|
-
* Use `
|
|
10179
|
-
*
|
|
10180
|
-
* Migration guide:
|
|
10181
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10182
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10183
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10483
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10484
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10184
10485
|
*
|
|
10185
|
-
*
|
|
10186
|
-
*
|
|
10187
|
-
* @see AiSearchAccountService
|
|
10188
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10486
|
+
* @param autoragId Instance ID
|
|
10189
10487
|
*/
|
|
10190
10488
|
autorag(autoragId: string): AutoRAG;
|
|
10191
10489
|
run<
|
|
@@ -10344,22 +10642,23 @@ export declare abstract class AiGateway {
|
|
|
10344
10642
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10345
10643
|
}
|
|
10346
10644
|
/**
|
|
10347
|
-
* @deprecated
|
|
10348
|
-
*
|
|
10645
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10646
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10349
10647
|
*/
|
|
10350
10648
|
export interface AutoRAGInternalError extends Error {}
|
|
10351
10649
|
/**
|
|
10352
|
-
* @deprecated
|
|
10353
|
-
*
|
|
10650
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10651
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10354
10652
|
*/
|
|
10355
10653
|
export interface AutoRAGNotFoundError extends Error {}
|
|
10356
10654
|
/**
|
|
10357
|
-
* @deprecated
|
|
10655
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10656
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10358
10657
|
*/
|
|
10359
10658
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
10360
10659
|
/**
|
|
10361
|
-
* @deprecated
|
|
10362
|
-
*
|
|
10660
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10661
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10363
10662
|
*/
|
|
10364
10663
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
10365
10664
|
export type ComparisonFilter = {
|
|
@@ -10372,9 +10671,8 @@ export type CompoundFilter = {
|
|
|
10372
10671
|
filters: ComparisonFilter[];
|
|
10373
10672
|
};
|
|
10374
10673
|
/**
|
|
10375
|
-
* @deprecated
|
|
10376
|
-
*
|
|
10377
|
-
* @see AiSearchSearchRequest
|
|
10674
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10675
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10378
10676
|
*/
|
|
10379
10677
|
export type AutoRagSearchRequest = {
|
|
10380
10678
|
query: string;
|
|
@@ -10391,18 +10689,16 @@ export type AutoRagSearchRequest = {
|
|
|
10391
10689
|
rewrite_query?: boolean;
|
|
10392
10690
|
};
|
|
10393
10691
|
/**
|
|
10394
|
-
* @deprecated
|
|
10395
|
-
*
|
|
10396
|
-
* @see AiSearchChatCompletionsRequest
|
|
10692
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10693
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10397
10694
|
*/
|
|
10398
10695
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10399
10696
|
stream?: boolean;
|
|
10400
10697
|
system_prompt?: string;
|
|
10401
10698
|
};
|
|
10402
10699
|
/**
|
|
10403
|
-
* @deprecated
|
|
10404
|
-
*
|
|
10405
|
-
* @see AiSearchChatCompletionsRequest
|
|
10700
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10701
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10406
10702
|
*/
|
|
10407
10703
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
10408
10704
|
AutoRagAiSearchRequest,
|
|
@@ -10411,9 +10707,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10411
10707
|
stream: true;
|
|
10412
10708
|
};
|
|
10413
10709
|
/**
|
|
10414
|
-
* @deprecated
|
|
10415
|
-
*
|
|
10416
|
-
* @see AiSearchSearchResponse
|
|
10710
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10711
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10417
10712
|
*/
|
|
10418
10713
|
export type AutoRagSearchResponse = {
|
|
10419
10714
|
object: "vector_store.search_results.page";
|
|
@@ -10432,9 +10727,8 @@ export type AutoRagSearchResponse = {
|
|
|
10432
10727
|
next_page: string | null;
|
|
10433
10728
|
};
|
|
10434
10729
|
/**
|
|
10435
|
-
* @deprecated
|
|
10436
|
-
*
|
|
10437
|
-
* @see AiSearchListResponse
|
|
10730
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10731
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10438
10732
|
*/
|
|
10439
10733
|
export type AutoRagListResponse = {
|
|
10440
10734
|
id: string;
|
|
@@ -10446,49 +10740,40 @@ export type AutoRagListResponse = {
|
|
|
10446
10740
|
status: string;
|
|
10447
10741
|
}[];
|
|
10448
10742
|
/**
|
|
10449
|
-
* @deprecated
|
|
10450
|
-
*
|
|
10743
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10744
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10451
10745
|
*/
|
|
10452
10746
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10453
10747
|
response: string;
|
|
10454
10748
|
};
|
|
10455
10749
|
/**
|
|
10456
|
-
* @deprecated
|
|
10457
|
-
*
|
|
10458
|
-
*
|
|
10459
|
-
* Migration guide:
|
|
10460
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10461
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10462
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10463
|
-
*
|
|
10464
|
-
* @see AiSearchAccountService
|
|
10465
|
-
* @see AiSearchInstanceService
|
|
10750
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10751
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10466
10752
|
*/
|
|
10467
10753
|
export declare abstract class AutoRAG {
|
|
10468
10754
|
/**
|
|
10469
|
-
* @deprecated Use
|
|
10470
|
-
*
|
|
10755
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10756
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10471
10757
|
*/
|
|
10472
10758
|
list(): Promise<AutoRagListResponse>;
|
|
10473
10759
|
/**
|
|
10474
|
-
* @deprecated Use
|
|
10475
|
-
*
|
|
10476
|
-
* @see AiSearchInstanceService.search
|
|
10760
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10761
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10477
10762
|
*/
|
|
10478
10763
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10479
10764
|
/**
|
|
10480
|
-
* @deprecated Use
|
|
10481
|
-
*
|
|
10765
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10766
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10482
10767
|
*/
|
|
10483
10768
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10484
10769
|
/**
|
|
10485
|
-
* @deprecated Use
|
|
10486
|
-
*
|
|
10770
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10771
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10487
10772
|
*/
|
|
10488
10773
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10489
10774
|
/**
|
|
10490
|
-
* @deprecated Use
|
|
10491
|
-
*
|
|
10775
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10776
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10492
10777
|
*/
|
|
10493
10778
|
aiSearch(
|
|
10494
10779
|
params: AutoRagAiSearchRequest,
|
|
@@ -13014,14 +13299,13 @@ export interface StreamScopedCaptions {
|
|
|
13014
13299
|
* Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.
|
|
13015
13300
|
* One caption or subtitle file per language is allowed.
|
|
13016
13301
|
* @param language The BCP 47 language tag for the caption or subtitle.
|
|
13017
|
-
* @param
|
|
13302
|
+
* @param input The caption or subtitle stream to upload.
|
|
13018
13303
|
* @returns The created caption entry.
|
|
13019
13304
|
* @throws {NotFoundError} if the video is not found
|
|
13020
13305
|
* @throws {BadRequestError} if the language or file is invalid
|
|
13021
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13022
13306
|
* @throws {InternalError} if an unexpected error occurs
|
|
13023
13307
|
*/
|
|
13024
|
-
upload(language: string,
|
|
13308
|
+
upload(language: string, input: ReadableStream): Promise<StreamCaption>;
|
|
13025
13309
|
/**
|
|
13026
13310
|
* Generate captions or subtitles for the provided language via AI.
|
|
13027
13311
|
* @param language The BCP 47 language tag to generate.
|
|
@@ -13097,17 +13381,16 @@ export interface StreamVideos {
|
|
|
13097
13381
|
export interface StreamWatermarks {
|
|
13098
13382
|
/**
|
|
13099
13383
|
* Generate a new watermark profile
|
|
13100
|
-
* @param
|
|
13384
|
+
* @param input The image stream to upload
|
|
13101
13385
|
* @param params The watermark creation parameters.
|
|
13102
13386
|
* @returns The created watermark profile.
|
|
13103
13387
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13104
13388
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13105
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13106
13389
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13107
13390
|
* @throws {InternalError} if an unexpected error occurs
|
|
13108
13391
|
*/
|
|
13109
13392
|
generate(
|
|
13110
|
-
|
|
13393
|
+
input: ReadableStream,
|
|
13111
13394
|
params: StreamWatermarkCreateParams,
|
|
13112
13395
|
): Promise<StreamWatermark>;
|
|
13113
13396
|
/**
|
|
@@ -13117,7 +13400,6 @@ export interface StreamWatermarks {
|
|
|
13117
13400
|
* @returns The created watermark profile.
|
|
13118
13401
|
* @throws {BadRequestError} if the parameters are invalid
|
|
13119
13402
|
* @throws {InvalidURLError} if the URL is invalid
|
|
13120
|
-
* @throws {MaxFileSizeError} if the file size is too large
|
|
13121
13403
|
* @throws {TooManyWatermarksError} if the number of allowed watermarks is reached
|
|
13122
13404
|
* @throws {InternalError} if an unexpected error occurs
|
|
13123
13405
|
*/
|