@cloudflare/workers-types 4.20260329.1 → 4.20260331.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 +379 -124
- package/2021-11-03/index.ts +379 -124
- package/2022-01-31/index.d.ts +379 -124
- package/2022-01-31/index.ts +379 -124
- package/2022-03-21/index.d.ts +379 -124
- package/2022-03-21/index.ts +379 -124
- package/2022-08-04/index.d.ts +379 -124
- package/2022-08-04/index.ts +379 -124
- package/2022-10-31/index.d.ts +379 -124
- package/2022-10-31/index.ts +379 -124
- package/2022-11-30/index.d.ts +379 -124
- package/2022-11-30/index.ts +379 -124
- package/2023-03-01/index.d.ts +379 -124
- package/2023-03-01/index.ts +379 -124
- package/2023-07-01/index.d.ts +379 -124
- package/2023-07-01/index.ts +379 -124
- package/experimental/index.d.ts +393 -126
- package/experimental/index.ts +393 -126
- package/index.d.ts +379 -124
- package/index.ts +379 -124
- package/latest/index.d.ts +379 -124
- package/latest/index.ts +379 -124
- package/oldest/index.d.ts +379 -124
- package/oldest/index.ts +379 -124
- package/package.json +1 -1
package/latest/index.d.ts
CHANGED
|
@@ -3115,6 +3115,11 @@ interface QueuingStrategyInit {
|
|
|
3115
3115
|
*/
|
|
3116
3116
|
highWaterMark: number;
|
|
3117
3117
|
}
|
|
3118
|
+
interface TracePreviewInfo {
|
|
3119
|
+
id: string;
|
|
3120
|
+
slug: string;
|
|
3121
|
+
name: string;
|
|
3122
|
+
}
|
|
3118
3123
|
interface ScriptVersion {
|
|
3119
3124
|
id?: string;
|
|
3120
3125
|
tag?: string;
|
|
@@ -3149,6 +3154,7 @@ interface TraceItem {
|
|
|
3149
3154
|
readonly dispatchNamespace?: string;
|
|
3150
3155
|
readonly scriptTags?: string[];
|
|
3151
3156
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3157
|
+
readonly preview?: TracePreviewInfo;
|
|
3152
3158
|
readonly durableObjectId?: string;
|
|
3153
3159
|
readonly outcome: string;
|
|
3154
3160
|
readonly executionModel: string;
|
|
@@ -3928,11 +3934,10 @@ declare abstract class Performance {
|
|
|
3928
3934
|
*/
|
|
3929
3935
|
toJSON(): object;
|
|
3930
3936
|
}
|
|
3931
|
-
// AI Search
|
|
3937
|
+
// ============ AI Search Error Interfaces ============
|
|
3932
3938
|
interface AiSearchInternalError extends Error {}
|
|
3933
3939
|
interface AiSearchNotFoundError extends Error {}
|
|
3934
|
-
|
|
3935
|
-
// AI Search V2 Request Types
|
|
3940
|
+
// ============ AI Search Request Types ============
|
|
3936
3941
|
type AiSearchSearchRequest = {
|
|
3937
3942
|
messages: Array<{
|
|
3938
3943
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3957,9 +3962,8 @@ type AiSearchSearchRequest = {
|
|
|
3957
3962
|
[key: string]: unknown;
|
|
3958
3963
|
};
|
|
3959
3964
|
reranking?: {
|
|
3960
|
-
/** Enable reranking (default false) */
|
|
3961
3965
|
enabled?: boolean;
|
|
3962
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3966
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3963
3967
|
/** Match threshold (0-1, default 0.4) */
|
|
3964
3968
|
match_threshold?: number;
|
|
3965
3969
|
[key: string]: unknown;
|
|
@@ -3971,6 +3975,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3971
3975
|
messages: Array<{
|
|
3972
3976
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3973
3977
|
content: string | null;
|
|
3978
|
+
[key: string]: unknown;
|
|
3974
3979
|
}>;
|
|
3975
3980
|
model?: string;
|
|
3976
3981
|
stream?: boolean;
|
|
@@ -3991,7 +3996,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3991
3996
|
};
|
|
3992
3997
|
reranking?: {
|
|
3993
3998
|
enabled?: boolean;
|
|
3994
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3999
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3995
4000
|
match_threshold?: number;
|
|
3996
4001
|
[key: string]: unknown;
|
|
3997
4002
|
};
|
|
@@ -3999,7 +4004,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3999
4004
|
};
|
|
4000
4005
|
[key: string]: unknown;
|
|
4001
4006
|
};
|
|
4002
|
-
// AI Search
|
|
4007
|
+
// ============ AI Search Response Types ============
|
|
4003
4008
|
type AiSearchSearchResponse = {
|
|
4004
4009
|
search_query: string;
|
|
4005
4010
|
chunks: Array<{
|
|
@@ -4018,26 +4023,65 @@ type AiSearchSearchResponse = {
|
|
|
4018
4023
|
keyword_score?: number;
|
|
4019
4024
|
/** Vector similarity score (0-1) */
|
|
4020
4025
|
vector_score?: number;
|
|
4026
|
+
[key: string]: unknown;
|
|
4027
|
+
};
|
|
4028
|
+
}>;
|
|
4029
|
+
};
|
|
4030
|
+
type AiSearchChatCompletionsResponse = {
|
|
4031
|
+
id?: string;
|
|
4032
|
+
object?: string;
|
|
4033
|
+
model?: string;
|
|
4034
|
+
choices: Array<{
|
|
4035
|
+
index?: number;
|
|
4036
|
+
message: {
|
|
4037
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4038
|
+
content: string | null;
|
|
4039
|
+
[key: string]: unknown;
|
|
4021
4040
|
};
|
|
4041
|
+
[key: string]: unknown;
|
|
4022
4042
|
}>;
|
|
4043
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4044
|
+
[key: string]: unknown;
|
|
4023
4045
|
};
|
|
4024
|
-
type
|
|
4046
|
+
type AiSearchStatsResponse = {
|
|
4047
|
+
queued?: number;
|
|
4048
|
+
running?: number;
|
|
4049
|
+
completed?: number;
|
|
4050
|
+
error?: number;
|
|
4051
|
+
skipped?: number;
|
|
4052
|
+
outdated?: number;
|
|
4053
|
+
last_activity?: string;
|
|
4054
|
+
};
|
|
4055
|
+
// ============ AI Search Instance Info Types ============
|
|
4056
|
+
type AiSearchInstanceInfo = {
|
|
4025
4057
|
id: string;
|
|
4026
|
-
|
|
4027
|
-
account_id?: string;
|
|
4028
|
-
account_tag?: string;
|
|
4029
|
-
/** Whether the instance is enabled (default true) */
|
|
4030
|
-
enable?: boolean;
|
|
4031
|
-
type?: "r2" | "web-crawler";
|
|
4058
|
+
type?: "r2" | "web-crawler" | string;
|
|
4032
4059
|
source?: string;
|
|
4060
|
+
paused?: boolean;
|
|
4061
|
+
status?: string;
|
|
4062
|
+
namespace?: string;
|
|
4063
|
+
created_at?: string;
|
|
4064
|
+
modified_at?: string;
|
|
4033
4065
|
[key: string]: unknown;
|
|
4034
|
-
}
|
|
4066
|
+
};
|
|
4067
|
+
type AiSearchListResponse = {
|
|
4068
|
+
result: AiSearchInstanceInfo[];
|
|
4069
|
+
result_info?: {
|
|
4070
|
+
count: number;
|
|
4071
|
+
page: number;
|
|
4072
|
+
per_page: number;
|
|
4073
|
+
total_count: number;
|
|
4074
|
+
};
|
|
4075
|
+
};
|
|
4076
|
+
// ============ AI Search Config Types ============
|
|
4035
4077
|
type AiSearchConfig = {
|
|
4036
4078
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4037
4079
|
id: string;
|
|
4038
|
-
type
|
|
4039
|
-
|
|
4040
|
-
|
|
4080
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4081
|
+
type?: "r2" | "web-crawler" | string;
|
|
4082
|
+
/** Source URL (required for web-crawler type). */
|
|
4083
|
+
source?: string;
|
|
4084
|
+
source_params?: unknown;
|
|
4041
4085
|
/** Token ID (UUID format) */
|
|
4042
4086
|
token_id?: string;
|
|
4043
4087
|
ai_gateway_id?: string;
|
|
@@ -4047,54 +4091,307 @@ type AiSearchConfig = {
|
|
|
4047
4091
|
reranking?: boolean;
|
|
4048
4092
|
embedding_model?: string;
|
|
4049
4093
|
ai_search_model?: string;
|
|
4094
|
+
[key: string]: unknown;
|
|
4050
4095
|
};
|
|
4051
|
-
|
|
4096
|
+
// ============ AI Search Item Types ============
|
|
4097
|
+
type AiSearchItemInfo = {
|
|
4052
4098
|
id: string;
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4099
|
+
key: string;
|
|
4100
|
+
status:
|
|
4101
|
+
| "completed"
|
|
4102
|
+
| "error"
|
|
4103
|
+
| "skipped"
|
|
4104
|
+
| "queued"
|
|
4105
|
+
| "processing"
|
|
4106
|
+
| "outdated";
|
|
4107
|
+
metadata?: Record<string, unknown>;
|
|
4056
4108
|
[key: string]: unknown;
|
|
4057
4109
|
};
|
|
4058
|
-
|
|
4059
|
-
|
|
4110
|
+
type AiSearchItemContentResult = {
|
|
4111
|
+
body: ReadableStream;
|
|
4112
|
+
contentType: string;
|
|
4113
|
+
filename: string;
|
|
4114
|
+
size: number;
|
|
4115
|
+
};
|
|
4116
|
+
type AiSearchUploadItemOptions = {
|
|
4117
|
+
metadata?: Record<string, unknown>;
|
|
4118
|
+
};
|
|
4119
|
+
type AiSearchListItemsParams = {
|
|
4120
|
+
page?: number;
|
|
4121
|
+
per_page?: number;
|
|
4122
|
+
};
|
|
4123
|
+
type AiSearchListItemsResponse = {
|
|
4124
|
+
result: AiSearchItemInfo[];
|
|
4125
|
+
result_info?: {
|
|
4126
|
+
count: number;
|
|
4127
|
+
page: number;
|
|
4128
|
+
per_page: number;
|
|
4129
|
+
total_count: number;
|
|
4130
|
+
};
|
|
4131
|
+
};
|
|
4132
|
+
// ============ AI Search Job Types ============
|
|
4133
|
+
type AiSearchJobInfo = {
|
|
4134
|
+
id: string;
|
|
4135
|
+
source: "user" | "schedule";
|
|
4136
|
+
description?: string;
|
|
4137
|
+
last_seen_at?: string;
|
|
4138
|
+
started_at?: string;
|
|
4139
|
+
ended_at?: string;
|
|
4140
|
+
end_reason?: string;
|
|
4141
|
+
};
|
|
4142
|
+
type AiSearchJobLog = {
|
|
4143
|
+
id: number;
|
|
4144
|
+
message: string;
|
|
4145
|
+
message_type: number;
|
|
4146
|
+
created_at: number;
|
|
4147
|
+
};
|
|
4148
|
+
type AiSearchCreateJobParams = {
|
|
4149
|
+
description?: string;
|
|
4150
|
+
};
|
|
4151
|
+
type AiSearchListJobsParams = {
|
|
4152
|
+
page?: number;
|
|
4153
|
+
per_page?: number;
|
|
4154
|
+
};
|
|
4155
|
+
type AiSearchListJobsResponse = {
|
|
4156
|
+
result: AiSearchJobInfo[];
|
|
4157
|
+
result_info?: {
|
|
4158
|
+
count: number;
|
|
4159
|
+
page: number;
|
|
4160
|
+
per_page: number;
|
|
4161
|
+
total_count: number;
|
|
4162
|
+
};
|
|
4163
|
+
};
|
|
4164
|
+
type AiSearchJobLogsParams = {
|
|
4165
|
+
page?: number;
|
|
4166
|
+
per_page?: number;
|
|
4167
|
+
};
|
|
4168
|
+
type AiSearchJobLogsResponse = {
|
|
4169
|
+
result: AiSearchJobLog[];
|
|
4170
|
+
result_info?: {
|
|
4171
|
+
count: number;
|
|
4172
|
+
page: number;
|
|
4173
|
+
per_page: number;
|
|
4174
|
+
total_count: number;
|
|
4175
|
+
};
|
|
4176
|
+
};
|
|
4177
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4178
|
+
/**
|
|
4179
|
+
* Single item service for an AI Search instance.
|
|
4180
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4181
|
+
*/
|
|
4182
|
+
declare abstract class AiSearchItem {
|
|
4183
|
+
/** Get metadata about this item. */
|
|
4184
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4185
|
+
/**
|
|
4186
|
+
* Download the item's content.
|
|
4187
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4188
|
+
*/
|
|
4189
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4190
|
+
}
|
|
4191
|
+
/**
|
|
4192
|
+
* Items collection service for an AI Search instance.
|
|
4193
|
+
* Provides list, upload, and access to individual items.
|
|
4194
|
+
*/
|
|
4195
|
+
declare abstract class AiSearchItems {
|
|
4196
|
+
/** List items in this instance. */
|
|
4197
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4198
|
+
/**
|
|
4199
|
+
* Upload a file as an item.
|
|
4200
|
+
* @param name Filename for the uploaded item.
|
|
4201
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4202
|
+
* @param options Optional metadata to attach to the item.
|
|
4203
|
+
* @returns The created item info.
|
|
4204
|
+
*/
|
|
4205
|
+
upload(
|
|
4206
|
+
name: string,
|
|
4207
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4208
|
+
options?: AiSearchUploadItemOptions,
|
|
4209
|
+
): Promise<AiSearchItemInfo>;
|
|
4210
|
+
/**
|
|
4211
|
+
* Upload a file and poll until processing completes.
|
|
4212
|
+
* @param name Filename for the uploaded item.
|
|
4213
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4214
|
+
* @param options Optional metadata to attach to the item.
|
|
4215
|
+
* @returns The item info after processing completes (or timeout).
|
|
4216
|
+
*/
|
|
4217
|
+
uploadAndPoll(
|
|
4218
|
+
name: string,
|
|
4219
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4220
|
+
options?: AiSearchUploadItemOptions,
|
|
4221
|
+
): Promise<AiSearchItemInfo>;
|
|
4222
|
+
/**
|
|
4223
|
+
* Get an item by ID.
|
|
4224
|
+
* @param itemId The item identifier.
|
|
4225
|
+
* @returns Item service for info, delete, and download operations.
|
|
4226
|
+
*/
|
|
4227
|
+
get(itemId: string): AiSearchItem;
|
|
4228
|
+
/** Delete this item from the instance.
|
|
4229
|
+
* @param itemId The item identifier.
|
|
4230
|
+
*/
|
|
4231
|
+
delete(itemId: string): Promise<void>;
|
|
4232
|
+
}
|
|
4233
|
+
/**
|
|
4234
|
+
* Single job service for an AI Search instance.
|
|
4235
|
+
* Provides info and logs for a specific job.
|
|
4236
|
+
*/
|
|
4237
|
+
declare abstract class AiSearchJob {
|
|
4238
|
+
/** Get metadata about this job. */
|
|
4239
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4240
|
+
/** Get logs for this job. */
|
|
4241
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4242
|
+
}
|
|
4243
|
+
/**
|
|
4244
|
+
* Jobs collection service for an AI Search instance.
|
|
4245
|
+
* Provides list, create, and access to individual jobs.
|
|
4246
|
+
*/
|
|
4247
|
+
declare abstract class AiSearchJobs {
|
|
4248
|
+
/** List jobs for this instance. */
|
|
4249
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4250
|
+
/**
|
|
4251
|
+
* Create a new indexing job.
|
|
4252
|
+
* @param params Optional job parameters.
|
|
4253
|
+
* @returns The created job info.
|
|
4254
|
+
*/
|
|
4255
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4256
|
+
/**
|
|
4257
|
+
* Get a job by ID.
|
|
4258
|
+
* @param jobId The job identifier.
|
|
4259
|
+
* @returns Job service for info and logs operations.
|
|
4260
|
+
*/
|
|
4261
|
+
get(jobId: string): AiSearchJob;
|
|
4262
|
+
}
|
|
4263
|
+
// ============ AI Search Binding Classes ============
|
|
4264
|
+
/**
|
|
4265
|
+
* Instance-level AI Search service.
|
|
4266
|
+
*
|
|
4267
|
+
* Used as:
|
|
4268
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4269
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4270
|
+
*
|
|
4271
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4272
|
+
*
|
|
4273
|
+
* @example
|
|
4274
|
+
* ```ts
|
|
4275
|
+
* // Via namespace binding
|
|
4276
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4277
|
+
* const results = await instance.search({
|
|
4278
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4279
|
+
* });
|
|
4280
|
+
*
|
|
4281
|
+
* // Via single instance binding
|
|
4282
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4283
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4284
|
+
* });
|
|
4285
|
+
* ```
|
|
4286
|
+
*/
|
|
4287
|
+
declare abstract class AiSearchInstance {
|
|
4060
4288
|
/**
|
|
4061
4289
|
* Search the AI Search instance for relevant chunks.
|
|
4062
|
-
* @param params Search request with messages and AI search options
|
|
4063
|
-
* @returns Search response with matching chunks
|
|
4290
|
+
* @param params Search request with messages and optional AI search options.
|
|
4291
|
+
* @returns Search response with matching chunks and search query.
|
|
4064
4292
|
*/
|
|
4065
4293
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4294
|
+
/**
|
|
4295
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4296
|
+
* @param params Chat completions request with stream: true.
|
|
4297
|
+
* @returns ReadableStream of server-sent events.
|
|
4298
|
+
*/
|
|
4299
|
+
chatCompletions(
|
|
4300
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4301
|
+
stream: true;
|
|
4302
|
+
},
|
|
4303
|
+
): Promise<ReadableStream>;
|
|
4066
4304
|
/**
|
|
4067
4305
|
* Generate chat completions with AI Search context.
|
|
4068
|
-
* @param params Chat completions request
|
|
4069
|
-
* @returns
|
|
4306
|
+
* @param params Chat completions request.
|
|
4307
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4070
4308
|
*/
|
|
4071
4309
|
chatCompletions(
|
|
4072
4310
|
params: AiSearchChatCompletionsRequest,
|
|
4073
|
-
): Promise<
|
|
4311
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4074
4312
|
/**
|
|
4075
|
-
*
|
|
4313
|
+
* Update the instance configuration.
|
|
4314
|
+
* @param config Partial configuration to update.
|
|
4315
|
+
* @returns Updated instance info.
|
|
4076
4316
|
*/
|
|
4077
|
-
|
|
4317
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4318
|
+
/** Get metadata about this instance. */
|
|
4319
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4320
|
+
/**
|
|
4321
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4322
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4323
|
+
*/
|
|
4324
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4325
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4326
|
+
get items(): AiSearchItems;
|
|
4327
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4328
|
+
get jobs(): AiSearchJobs;
|
|
4078
4329
|
}
|
|
4079
|
-
|
|
4080
|
-
|
|
4330
|
+
/**
|
|
4331
|
+
* Namespace-level AI Search service.
|
|
4332
|
+
*
|
|
4333
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4334
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4335
|
+
*
|
|
4336
|
+
* @example
|
|
4337
|
+
* ```ts
|
|
4338
|
+
* // Access an instance within the namespace
|
|
4339
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4340
|
+
* const results = await blog.search({
|
|
4341
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4342
|
+
* });
|
|
4343
|
+
*
|
|
4344
|
+
* // List all instances in the namespace
|
|
4345
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4346
|
+
*
|
|
4347
|
+
* // Create a new instance with built-in storage
|
|
4348
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4349
|
+
* id: "tenant-123",
|
|
4350
|
+
* });
|
|
4351
|
+
*
|
|
4352
|
+
* // Upload items into the instance
|
|
4353
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4354
|
+
*
|
|
4355
|
+
* // Delete an instance
|
|
4356
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4357
|
+
* ```
|
|
4358
|
+
*/
|
|
4359
|
+
declare abstract class AiSearchNamespace {
|
|
4081
4360
|
/**
|
|
4082
|
-
*
|
|
4083
|
-
* @
|
|
4361
|
+
* Get an instance by name within the bound namespace.
|
|
4362
|
+
* @param name Instance name.
|
|
4363
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4364
|
+
*/
|
|
4365
|
+
get(name: string): AiSearchInstance;
|
|
4366
|
+
/**
|
|
4367
|
+
* List all instances in the bound namespace.
|
|
4368
|
+
* @returns Array of instance metadata.
|
|
4084
4369
|
*/
|
|
4085
4370
|
list(): Promise<AiSearchListResponse>;
|
|
4086
4371
|
/**
|
|
4087
|
-
*
|
|
4088
|
-
* @param
|
|
4089
|
-
* @returns Instance service for
|
|
4372
|
+
* Create a new instance within the bound namespace.
|
|
4373
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4374
|
+
* @returns Instance service for the newly created instance.
|
|
4375
|
+
*
|
|
4376
|
+
* @example
|
|
4377
|
+
* ```ts
|
|
4378
|
+
* // Create with built-in storage (upload items manually)
|
|
4379
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4380
|
+
*
|
|
4381
|
+
* // Create with web crawler source
|
|
4382
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4383
|
+
* id: "docs-search",
|
|
4384
|
+
* type: "web-crawler",
|
|
4385
|
+
* source: "https://developers.cloudflare.com",
|
|
4386
|
+
* });
|
|
4387
|
+
* ```
|
|
4090
4388
|
*/
|
|
4091
|
-
|
|
4389
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4092
4390
|
/**
|
|
4093
|
-
*
|
|
4094
|
-
* @param
|
|
4095
|
-
* @returns Instance service for performing operations
|
|
4391
|
+
* Delete an instance from the bound namespace.
|
|
4392
|
+
* @param name Instance name to delete.
|
|
4096
4393
|
*/
|
|
4097
|
-
|
|
4394
|
+
delete(name: string): Promise<void>;
|
|
4098
4395
|
}
|
|
4099
4396
|
type AiImageClassificationInput = {
|
|
4100
4397
|
image: number[];
|
|
@@ -10092,6 +10389,7 @@ type AiOptions = {
|
|
|
10092
10389
|
returnRawResponse?: boolean;
|
|
10093
10390
|
prefix?: string;
|
|
10094
10391
|
extraHeaders?: object;
|
|
10392
|
+
signal?: AbortSignal;
|
|
10095
10393
|
};
|
|
10096
10394
|
type AiModelsSearchParams = {
|
|
10097
10395
|
author?: string;
|
|
@@ -10135,46 +10433,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10135
10433
|
aiGatewayLogId: string | null;
|
|
10136
10434
|
gateway(gatewayId: string): AiGateway;
|
|
10137
10435
|
/**
|
|
10138
|
-
*
|
|
10139
|
-
*
|
|
10140
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10141
|
-
* - Account-level operations: `list()`, `create()`
|
|
10142
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10143
|
-
*
|
|
10144
|
-
* @example
|
|
10145
|
-
* ```typescript
|
|
10146
|
-
* // List all AI Search instances
|
|
10147
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10148
|
-
*
|
|
10149
|
-
* // Search an instance
|
|
10150
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10151
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10152
|
-
* ai_search_options: {
|
|
10153
|
-
* retrieval: { max_num_results: 10 }
|
|
10154
|
-
* }
|
|
10155
|
-
* });
|
|
10156
|
-
*
|
|
10157
|
-
* // Generate chat completions with AI Search context
|
|
10158
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10159
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10160
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10161
|
-
* });
|
|
10162
|
-
* ```
|
|
10436
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10437
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10163
10438
|
*/
|
|
10164
|
-
aiSearch():
|
|
10439
|
+
aiSearch(): AiSearchNamespace;
|
|
10165
10440
|
/**
|
|
10166
10441
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10167
|
-
* Use `
|
|
10168
|
-
*
|
|
10169
|
-
* Migration guide:
|
|
10170
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10171
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10172
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10442
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10443
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10173
10444
|
*
|
|
10174
|
-
*
|
|
10175
|
-
*
|
|
10176
|
-
* @see AiSearchAccountService
|
|
10177
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10445
|
+
* @param autoragId Instance ID
|
|
10178
10446
|
*/
|
|
10179
10447
|
autorag(autoragId: string): AutoRAG;
|
|
10180
10448
|
run<
|
|
@@ -10333,22 +10601,23 @@ declare abstract class AiGateway {
|
|
|
10333
10601
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10334
10602
|
}
|
|
10335
10603
|
/**
|
|
10336
|
-
* @deprecated
|
|
10337
|
-
*
|
|
10604
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10605
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10338
10606
|
*/
|
|
10339
10607
|
interface AutoRAGInternalError extends Error {}
|
|
10340
10608
|
/**
|
|
10341
|
-
* @deprecated
|
|
10342
|
-
*
|
|
10609
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10610
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10343
10611
|
*/
|
|
10344
10612
|
interface AutoRAGNotFoundError extends Error {}
|
|
10345
10613
|
/**
|
|
10346
|
-
* @deprecated
|
|
10614
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10615
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10347
10616
|
*/
|
|
10348
10617
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10349
10618
|
/**
|
|
10350
|
-
* @deprecated
|
|
10351
|
-
*
|
|
10619
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10620
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10352
10621
|
*/
|
|
10353
10622
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10354
10623
|
type ComparisonFilter = {
|
|
@@ -10361,9 +10630,8 @@ type CompoundFilter = {
|
|
|
10361
10630
|
filters: ComparisonFilter[];
|
|
10362
10631
|
};
|
|
10363
10632
|
/**
|
|
10364
|
-
* @deprecated
|
|
10365
|
-
*
|
|
10366
|
-
* @see AiSearchSearchRequest
|
|
10633
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10634
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10367
10635
|
*/
|
|
10368
10636
|
type AutoRagSearchRequest = {
|
|
10369
10637
|
query: string;
|
|
@@ -10380,18 +10648,16 @@ type AutoRagSearchRequest = {
|
|
|
10380
10648
|
rewrite_query?: boolean;
|
|
10381
10649
|
};
|
|
10382
10650
|
/**
|
|
10383
|
-
* @deprecated
|
|
10384
|
-
*
|
|
10385
|
-
* @see AiSearchChatCompletionsRequest
|
|
10651
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10652
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10386
10653
|
*/
|
|
10387
10654
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10388
10655
|
stream?: boolean;
|
|
10389
10656
|
system_prompt?: string;
|
|
10390
10657
|
};
|
|
10391
10658
|
/**
|
|
10392
|
-
* @deprecated
|
|
10393
|
-
*
|
|
10394
|
-
* @see AiSearchChatCompletionsRequest
|
|
10659
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10660
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10395
10661
|
*/
|
|
10396
10662
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10397
10663
|
AutoRagAiSearchRequest,
|
|
@@ -10400,9 +10666,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10400
10666
|
stream: true;
|
|
10401
10667
|
};
|
|
10402
10668
|
/**
|
|
10403
|
-
* @deprecated
|
|
10404
|
-
*
|
|
10405
|
-
* @see AiSearchSearchResponse
|
|
10669
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10670
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10406
10671
|
*/
|
|
10407
10672
|
type AutoRagSearchResponse = {
|
|
10408
10673
|
object: "vector_store.search_results.page";
|
|
@@ -10421,9 +10686,8 @@ type AutoRagSearchResponse = {
|
|
|
10421
10686
|
next_page: string | null;
|
|
10422
10687
|
};
|
|
10423
10688
|
/**
|
|
10424
|
-
* @deprecated
|
|
10425
|
-
*
|
|
10426
|
-
* @see AiSearchListResponse
|
|
10689
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10690
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10427
10691
|
*/
|
|
10428
10692
|
type AutoRagListResponse = {
|
|
10429
10693
|
id: string;
|
|
@@ -10435,49 +10699,40 @@ type AutoRagListResponse = {
|
|
|
10435
10699
|
status: string;
|
|
10436
10700
|
}[];
|
|
10437
10701
|
/**
|
|
10438
|
-
* @deprecated
|
|
10439
|
-
*
|
|
10702
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10703
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10440
10704
|
*/
|
|
10441
10705
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10442
10706
|
response: string;
|
|
10443
10707
|
};
|
|
10444
10708
|
/**
|
|
10445
|
-
* @deprecated
|
|
10446
|
-
*
|
|
10447
|
-
*
|
|
10448
|
-
* Migration guide:
|
|
10449
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10450
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10451
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10452
|
-
*
|
|
10453
|
-
* @see AiSearchAccountService
|
|
10454
|
-
* @see AiSearchInstanceService
|
|
10709
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10710
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10455
10711
|
*/
|
|
10456
10712
|
declare abstract class AutoRAG {
|
|
10457
10713
|
/**
|
|
10458
|
-
* @deprecated Use
|
|
10459
|
-
*
|
|
10714
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10715
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10460
10716
|
*/
|
|
10461
10717
|
list(): Promise<AutoRagListResponse>;
|
|
10462
10718
|
/**
|
|
10463
|
-
* @deprecated Use
|
|
10464
|
-
*
|
|
10465
|
-
* @see AiSearchInstanceService.search
|
|
10719
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10720
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10466
10721
|
*/
|
|
10467
10722
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10468
10723
|
/**
|
|
10469
|
-
* @deprecated Use
|
|
10470
|
-
*
|
|
10724
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10725
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10471
10726
|
*/
|
|
10472
10727
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10473
10728
|
/**
|
|
10474
|
-
* @deprecated Use
|
|
10475
|
-
*
|
|
10729
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10730
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10476
10731
|
*/
|
|
10477
10732
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10478
10733
|
/**
|
|
10479
|
-
* @deprecated Use
|
|
10480
|
-
*
|
|
10734
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10735
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10481
10736
|
*/
|
|
10482
10737
|
aiSearch(
|
|
10483
10738
|
params: AutoRagAiSearchRequest,
|