@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/2022-10-31/index.d.ts
CHANGED
|
@@ -3092,6 +3092,11 @@ interface QueuingStrategyInit {
|
|
|
3092
3092
|
*/
|
|
3093
3093
|
highWaterMark: number;
|
|
3094
3094
|
}
|
|
3095
|
+
interface TracePreviewInfo {
|
|
3096
|
+
id: string;
|
|
3097
|
+
slug: string;
|
|
3098
|
+
name: string;
|
|
3099
|
+
}
|
|
3095
3100
|
interface ScriptVersion {
|
|
3096
3101
|
id?: string;
|
|
3097
3102
|
tag?: string;
|
|
@@ -3126,6 +3131,7 @@ interface TraceItem {
|
|
|
3126
3131
|
readonly dispatchNamespace?: string;
|
|
3127
3132
|
readonly scriptTags?: string[];
|
|
3128
3133
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3134
|
+
readonly preview?: TracePreviewInfo;
|
|
3129
3135
|
readonly durableObjectId?: string;
|
|
3130
3136
|
readonly outcome: string;
|
|
3131
3137
|
readonly executionModel: string;
|
|
@@ -3884,11 +3890,10 @@ declare abstract class Performance {
|
|
|
3884
3890
|
*/
|
|
3885
3891
|
toJSON(): object;
|
|
3886
3892
|
}
|
|
3887
|
-
// AI Search
|
|
3893
|
+
// ============ AI Search Error Interfaces ============
|
|
3888
3894
|
interface AiSearchInternalError extends Error {}
|
|
3889
3895
|
interface AiSearchNotFoundError extends Error {}
|
|
3890
|
-
|
|
3891
|
-
// AI Search V2 Request Types
|
|
3896
|
+
// ============ AI Search Request Types ============
|
|
3892
3897
|
type AiSearchSearchRequest = {
|
|
3893
3898
|
messages: Array<{
|
|
3894
3899
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3913,9 +3918,8 @@ type AiSearchSearchRequest = {
|
|
|
3913
3918
|
[key: string]: unknown;
|
|
3914
3919
|
};
|
|
3915
3920
|
reranking?: {
|
|
3916
|
-
/** Enable reranking (default false) */
|
|
3917
3921
|
enabled?: boolean;
|
|
3918
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3922
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3919
3923
|
/** Match threshold (0-1, default 0.4) */
|
|
3920
3924
|
match_threshold?: number;
|
|
3921
3925
|
[key: string]: unknown;
|
|
@@ -3927,6 +3931,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3927
3931
|
messages: Array<{
|
|
3928
3932
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3929
3933
|
content: string | null;
|
|
3934
|
+
[key: string]: unknown;
|
|
3930
3935
|
}>;
|
|
3931
3936
|
model?: string;
|
|
3932
3937
|
stream?: boolean;
|
|
@@ -3947,7 +3952,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3947
3952
|
};
|
|
3948
3953
|
reranking?: {
|
|
3949
3954
|
enabled?: boolean;
|
|
3950
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3955
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3951
3956
|
match_threshold?: number;
|
|
3952
3957
|
[key: string]: unknown;
|
|
3953
3958
|
};
|
|
@@ -3955,7 +3960,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3955
3960
|
};
|
|
3956
3961
|
[key: string]: unknown;
|
|
3957
3962
|
};
|
|
3958
|
-
// AI Search
|
|
3963
|
+
// ============ AI Search Response Types ============
|
|
3959
3964
|
type AiSearchSearchResponse = {
|
|
3960
3965
|
search_query: string;
|
|
3961
3966
|
chunks: Array<{
|
|
@@ -3974,26 +3979,65 @@ type AiSearchSearchResponse = {
|
|
|
3974
3979
|
keyword_score?: number;
|
|
3975
3980
|
/** Vector similarity score (0-1) */
|
|
3976
3981
|
vector_score?: number;
|
|
3982
|
+
[key: string]: unknown;
|
|
3983
|
+
};
|
|
3984
|
+
}>;
|
|
3985
|
+
};
|
|
3986
|
+
type AiSearchChatCompletionsResponse = {
|
|
3987
|
+
id?: string;
|
|
3988
|
+
object?: string;
|
|
3989
|
+
model?: string;
|
|
3990
|
+
choices: Array<{
|
|
3991
|
+
index?: number;
|
|
3992
|
+
message: {
|
|
3993
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3994
|
+
content: string | null;
|
|
3995
|
+
[key: string]: unknown;
|
|
3977
3996
|
};
|
|
3997
|
+
[key: string]: unknown;
|
|
3978
3998
|
}>;
|
|
3999
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4000
|
+
[key: string]: unknown;
|
|
3979
4001
|
};
|
|
3980
|
-
type
|
|
4002
|
+
type AiSearchStatsResponse = {
|
|
4003
|
+
queued?: number;
|
|
4004
|
+
running?: number;
|
|
4005
|
+
completed?: number;
|
|
4006
|
+
error?: number;
|
|
4007
|
+
skipped?: number;
|
|
4008
|
+
outdated?: number;
|
|
4009
|
+
last_activity?: string;
|
|
4010
|
+
};
|
|
4011
|
+
// ============ AI Search Instance Info Types ============
|
|
4012
|
+
type AiSearchInstanceInfo = {
|
|
3981
4013
|
id: string;
|
|
3982
|
-
|
|
3983
|
-
account_id?: string;
|
|
3984
|
-
account_tag?: string;
|
|
3985
|
-
/** Whether the instance is enabled (default true) */
|
|
3986
|
-
enable?: boolean;
|
|
3987
|
-
type?: "r2" | "web-crawler";
|
|
4014
|
+
type?: "r2" | "web-crawler" | string;
|
|
3988
4015
|
source?: string;
|
|
4016
|
+
paused?: boolean;
|
|
4017
|
+
status?: string;
|
|
4018
|
+
namespace?: string;
|
|
4019
|
+
created_at?: string;
|
|
4020
|
+
modified_at?: string;
|
|
3989
4021
|
[key: string]: unknown;
|
|
3990
|
-
}
|
|
4022
|
+
};
|
|
4023
|
+
type AiSearchListResponse = {
|
|
4024
|
+
result: AiSearchInstanceInfo[];
|
|
4025
|
+
result_info?: {
|
|
4026
|
+
count: number;
|
|
4027
|
+
page: number;
|
|
4028
|
+
per_page: number;
|
|
4029
|
+
total_count: number;
|
|
4030
|
+
};
|
|
4031
|
+
};
|
|
4032
|
+
// ============ AI Search Config Types ============
|
|
3991
4033
|
type AiSearchConfig = {
|
|
3992
4034
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3993
4035
|
id: string;
|
|
3994
|
-
type
|
|
3995
|
-
|
|
3996
|
-
|
|
4036
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4037
|
+
type?: "r2" | "web-crawler" | string;
|
|
4038
|
+
/** Source URL (required for web-crawler type). */
|
|
4039
|
+
source?: string;
|
|
4040
|
+
source_params?: unknown;
|
|
3997
4041
|
/** Token ID (UUID format) */
|
|
3998
4042
|
token_id?: string;
|
|
3999
4043
|
ai_gateway_id?: string;
|
|
@@ -4003,54 +4047,307 @@ type AiSearchConfig = {
|
|
|
4003
4047
|
reranking?: boolean;
|
|
4004
4048
|
embedding_model?: string;
|
|
4005
4049
|
ai_search_model?: string;
|
|
4050
|
+
[key: string]: unknown;
|
|
4006
4051
|
};
|
|
4007
|
-
|
|
4052
|
+
// ============ AI Search Item Types ============
|
|
4053
|
+
type AiSearchItemInfo = {
|
|
4008
4054
|
id: string;
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4055
|
+
key: string;
|
|
4056
|
+
status:
|
|
4057
|
+
| "completed"
|
|
4058
|
+
| "error"
|
|
4059
|
+
| "skipped"
|
|
4060
|
+
| "queued"
|
|
4061
|
+
| "processing"
|
|
4062
|
+
| "outdated";
|
|
4063
|
+
metadata?: Record<string, unknown>;
|
|
4012
4064
|
[key: string]: unknown;
|
|
4013
4065
|
};
|
|
4014
|
-
|
|
4015
|
-
|
|
4066
|
+
type AiSearchItemContentResult = {
|
|
4067
|
+
body: ReadableStream;
|
|
4068
|
+
contentType: string;
|
|
4069
|
+
filename: string;
|
|
4070
|
+
size: number;
|
|
4071
|
+
};
|
|
4072
|
+
type AiSearchUploadItemOptions = {
|
|
4073
|
+
metadata?: Record<string, unknown>;
|
|
4074
|
+
};
|
|
4075
|
+
type AiSearchListItemsParams = {
|
|
4076
|
+
page?: number;
|
|
4077
|
+
per_page?: number;
|
|
4078
|
+
};
|
|
4079
|
+
type AiSearchListItemsResponse = {
|
|
4080
|
+
result: AiSearchItemInfo[];
|
|
4081
|
+
result_info?: {
|
|
4082
|
+
count: number;
|
|
4083
|
+
page: number;
|
|
4084
|
+
per_page: number;
|
|
4085
|
+
total_count: number;
|
|
4086
|
+
};
|
|
4087
|
+
};
|
|
4088
|
+
// ============ AI Search Job Types ============
|
|
4089
|
+
type AiSearchJobInfo = {
|
|
4090
|
+
id: string;
|
|
4091
|
+
source: "user" | "schedule";
|
|
4092
|
+
description?: string;
|
|
4093
|
+
last_seen_at?: string;
|
|
4094
|
+
started_at?: string;
|
|
4095
|
+
ended_at?: string;
|
|
4096
|
+
end_reason?: string;
|
|
4097
|
+
};
|
|
4098
|
+
type AiSearchJobLog = {
|
|
4099
|
+
id: number;
|
|
4100
|
+
message: string;
|
|
4101
|
+
message_type: number;
|
|
4102
|
+
created_at: number;
|
|
4103
|
+
};
|
|
4104
|
+
type AiSearchCreateJobParams = {
|
|
4105
|
+
description?: string;
|
|
4106
|
+
};
|
|
4107
|
+
type AiSearchListJobsParams = {
|
|
4108
|
+
page?: number;
|
|
4109
|
+
per_page?: number;
|
|
4110
|
+
};
|
|
4111
|
+
type AiSearchListJobsResponse = {
|
|
4112
|
+
result: AiSearchJobInfo[];
|
|
4113
|
+
result_info?: {
|
|
4114
|
+
count: number;
|
|
4115
|
+
page: number;
|
|
4116
|
+
per_page: number;
|
|
4117
|
+
total_count: number;
|
|
4118
|
+
};
|
|
4119
|
+
};
|
|
4120
|
+
type AiSearchJobLogsParams = {
|
|
4121
|
+
page?: number;
|
|
4122
|
+
per_page?: number;
|
|
4123
|
+
};
|
|
4124
|
+
type AiSearchJobLogsResponse = {
|
|
4125
|
+
result: AiSearchJobLog[];
|
|
4126
|
+
result_info?: {
|
|
4127
|
+
count: number;
|
|
4128
|
+
page: number;
|
|
4129
|
+
per_page: number;
|
|
4130
|
+
total_count: number;
|
|
4131
|
+
};
|
|
4132
|
+
};
|
|
4133
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4134
|
+
/**
|
|
4135
|
+
* Single item service for an AI Search instance.
|
|
4136
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4137
|
+
*/
|
|
4138
|
+
declare abstract class AiSearchItem {
|
|
4139
|
+
/** Get metadata about this item. */
|
|
4140
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4141
|
+
/**
|
|
4142
|
+
* Download the item's content.
|
|
4143
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4144
|
+
*/
|
|
4145
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4146
|
+
}
|
|
4147
|
+
/**
|
|
4148
|
+
* Items collection service for an AI Search instance.
|
|
4149
|
+
* Provides list, upload, and access to individual items.
|
|
4150
|
+
*/
|
|
4151
|
+
declare abstract class AiSearchItems {
|
|
4152
|
+
/** List items in this instance. */
|
|
4153
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4154
|
+
/**
|
|
4155
|
+
* Upload a file as an item.
|
|
4156
|
+
* @param name Filename for the uploaded item.
|
|
4157
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4158
|
+
* @param options Optional metadata to attach to the item.
|
|
4159
|
+
* @returns The created item info.
|
|
4160
|
+
*/
|
|
4161
|
+
upload(
|
|
4162
|
+
name: string,
|
|
4163
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4164
|
+
options?: AiSearchUploadItemOptions,
|
|
4165
|
+
): Promise<AiSearchItemInfo>;
|
|
4166
|
+
/**
|
|
4167
|
+
* Upload a file and poll until processing completes.
|
|
4168
|
+
* @param name Filename for the uploaded item.
|
|
4169
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4170
|
+
* @param options Optional metadata to attach to the item.
|
|
4171
|
+
* @returns The item info after processing completes (or timeout).
|
|
4172
|
+
*/
|
|
4173
|
+
uploadAndPoll(
|
|
4174
|
+
name: string,
|
|
4175
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4176
|
+
options?: AiSearchUploadItemOptions,
|
|
4177
|
+
): Promise<AiSearchItemInfo>;
|
|
4178
|
+
/**
|
|
4179
|
+
* Get an item by ID.
|
|
4180
|
+
* @param itemId The item identifier.
|
|
4181
|
+
* @returns Item service for info, delete, and download operations.
|
|
4182
|
+
*/
|
|
4183
|
+
get(itemId: string): AiSearchItem;
|
|
4184
|
+
/** Delete this item from the instance.
|
|
4185
|
+
* @param itemId The item identifier.
|
|
4186
|
+
*/
|
|
4187
|
+
delete(itemId: string): Promise<void>;
|
|
4188
|
+
}
|
|
4189
|
+
/**
|
|
4190
|
+
* Single job service for an AI Search instance.
|
|
4191
|
+
* Provides info and logs for a specific job.
|
|
4192
|
+
*/
|
|
4193
|
+
declare abstract class AiSearchJob {
|
|
4194
|
+
/** Get metadata about this job. */
|
|
4195
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4196
|
+
/** Get logs for this job. */
|
|
4197
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4198
|
+
}
|
|
4199
|
+
/**
|
|
4200
|
+
* Jobs collection service for an AI Search instance.
|
|
4201
|
+
* Provides list, create, and access to individual jobs.
|
|
4202
|
+
*/
|
|
4203
|
+
declare abstract class AiSearchJobs {
|
|
4204
|
+
/** List jobs for this instance. */
|
|
4205
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4206
|
+
/**
|
|
4207
|
+
* Create a new indexing job.
|
|
4208
|
+
* @param params Optional job parameters.
|
|
4209
|
+
* @returns The created job info.
|
|
4210
|
+
*/
|
|
4211
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4212
|
+
/**
|
|
4213
|
+
* Get a job by ID.
|
|
4214
|
+
* @param jobId The job identifier.
|
|
4215
|
+
* @returns Job service for info and logs operations.
|
|
4216
|
+
*/
|
|
4217
|
+
get(jobId: string): AiSearchJob;
|
|
4218
|
+
}
|
|
4219
|
+
// ============ AI Search Binding Classes ============
|
|
4220
|
+
/**
|
|
4221
|
+
* Instance-level AI Search service.
|
|
4222
|
+
*
|
|
4223
|
+
* Used as:
|
|
4224
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4225
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4226
|
+
*
|
|
4227
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4228
|
+
*
|
|
4229
|
+
* @example
|
|
4230
|
+
* ```ts
|
|
4231
|
+
* // Via namespace binding
|
|
4232
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4233
|
+
* const results = await instance.search({
|
|
4234
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4235
|
+
* });
|
|
4236
|
+
*
|
|
4237
|
+
* // Via single instance binding
|
|
4238
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4239
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4240
|
+
* });
|
|
4241
|
+
* ```
|
|
4242
|
+
*/
|
|
4243
|
+
declare abstract class AiSearchInstance {
|
|
4016
4244
|
/**
|
|
4017
4245
|
* Search the AI Search instance for relevant chunks.
|
|
4018
|
-
* @param params Search request with messages and AI search options
|
|
4019
|
-
* @returns Search response with matching chunks
|
|
4246
|
+
* @param params Search request with messages and optional AI search options.
|
|
4247
|
+
* @returns Search response with matching chunks and search query.
|
|
4020
4248
|
*/
|
|
4021
4249
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4250
|
+
/**
|
|
4251
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4252
|
+
* @param params Chat completions request with stream: true.
|
|
4253
|
+
* @returns ReadableStream of server-sent events.
|
|
4254
|
+
*/
|
|
4255
|
+
chatCompletions(
|
|
4256
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4257
|
+
stream: true;
|
|
4258
|
+
},
|
|
4259
|
+
): Promise<ReadableStream>;
|
|
4022
4260
|
/**
|
|
4023
4261
|
* Generate chat completions with AI Search context.
|
|
4024
|
-
* @param params Chat completions request
|
|
4025
|
-
* @returns
|
|
4262
|
+
* @param params Chat completions request.
|
|
4263
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4026
4264
|
*/
|
|
4027
4265
|
chatCompletions(
|
|
4028
4266
|
params: AiSearchChatCompletionsRequest,
|
|
4029
|
-
): Promise<
|
|
4267
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4030
4268
|
/**
|
|
4031
|
-
*
|
|
4269
|
+
* Update the instance configuration.
|
|
4270
|
+
* @param config Partial configuration to update.
|
|
4271
|
+
* @returns Updated instance info.
|
|
4032
4272
|
*/
|
|
4033
|
-
|
|
4273
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4274
|
+
/** Get metadata about this instance. */
|
|
4275
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4276
|
+
/**
|
|
4277
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4278
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4279
|
+
*/
|
|
4280
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4281
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4282
|
+
get items(): AiSearchItems;
|
|
4283
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4284
|
+
get jobs(): AiSearchJobs;
|
|
4034
4285
|
}
|
|
4035
|
-
|
|
4036
|
-
|
|
4286
|
+
/**
|
|
4287
|
+
* Namespace-level AI Search service.
|
|
4288
|
+
*
|
|
4289
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4290
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4291
|
+
*
|
|
4292
|
+
* @example
|
|
4293
|
+
* ```ts
|
|
4294
|
+
* // Access an instance within the namespace
|
|
4295
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4296
|
+
* const results = await blog.search({
|
|
4297
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4298
|
+
* });
|
|
4299
|
+
*
|
|
4300
|
+
* // List all instances in the namespace
|
|
4301
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4302
|
+
*
|
|
4303
|
+
* // Create a new instance with built-in storage
|
|
4304
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4305
|
+
* id: "tenant-123",
|
|
4306
|
+
* });
|
|
4307
|
+
*
|
|
4308
|
+
* // Upload items into the instance
|
|
4309
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4310
|
+
*
|
|
4311
|
+
* // Delete an instance
|
|
4312
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4313
|
+
* ```
|
|
4314
|
+
*/
|
|
4315
|
+
declare abstract class AiSearchNamespace {
|
|
4037
4316
|
/**
|
|
4038
|
-
*
|
|
4039
|
-
* @
|
|
4317
|
+
* Get an instance by name within the bound namespace.
|
|
4318
|
+
* @param name Instance name.
|
|
4319
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4320
|
+
*/
|
|
4321
|
+
get(name: string): AiSearchInstance;
|
|
4322
|
+
/**
|
|
4323
|
+
* List all instances in the bound namespace.
|
|
4324
|
+
* @returns Array of instance metadata.
|
|
4040
4325
|
*/
|
|
4041
4326
|
list(): Promise<AiSearchListResponse>;
|
|
4042
4327
|
/**
|
|
4043
|
-
*
|
|
4044
|
-
* @param
|
|
4045
|
-
* @returns Instance service for
|
|
4328
|
+
* Create a new instance within the bound namespace.
|
|
4329
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4330
|
+
* @returns Instance service for the newly created instance.
|
|
4331
|
+
*
|
|
4332
|
+
* @example
|
|
4333
|
+
* ```ts
|
|
4334
|
+
* // Create with built-in storage (upload items manually)
|
|
4335
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4336
|
+
*
|
|
4337
|
+
* // Create with web crawler source
|
|
4338
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4339
|
+
* id: "docs-search",
|
|
4340
|
+
* type: "web-crawler",
|
|
4341
|
+
* source: "https://developers.cloudflare.com",
|
|
4342
|
+
* });
|
|
4343
|
+
* ```
|
|
4046
4344
|
*/
|
|
4047
|
-
|
|
4345
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4048
4346
|
/**
|
|
4049
|
-
*
|
|
4050
|
-
* @param
|
|
4051
|
-
* @returns Instance service for performing operations
|
|
4347
|
+
* Delete an instance from the bound namespace.
|
|
4348
|
+
* @param name Instance name to delete.
|
|
4052
4349
|
*/
|
|
4053
|
-
|
|
4350
|
+
delete(name: string): Promise<void>;
|
|
4054
4351
|
}
|
|
4055
4352
|
type AiImageClassificationInput = {
|
|
4056
4353
|
image: number[];
|
|
@@ -10048,6 +10345,7 @@ type AiOptions = {
|
|
|
10048
10345
|
returnRawResponse?: boolean;
|
|
10049
10346
|
prefix?: string;
|
|
10050
10347
|
extraHeaders?: object;
|
|
10348
|
+
signal?: AbortSignal;
|
|
10051
10349
|
};
|
|
10052
10350
|
type AiModelsSearchParams = {
|
|
10053
10351
|
author?: string;
|
|
@@ -10091,46 +10389,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10091
10389
|
aiGatewayLogId: string | null;
|
|
10092
10390
|
gateway(gatewayId: string): AiGateway;
|
|
10093
10391
|
/**
|
|
10094
|
-
*
|
|
10095
|
-
*
|
|
10096
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10097
|
-
* - Account-level operations: `list()`, `create()`
|
|
10098
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10099
|
-
*
|
|
10100
|
-
* @example
|
|
10101
|
-
* ```typescript
|
|
10102
|
-
* // List all AI Search instances
|
|
10103
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10104
|
-
*
|
|
10105
|
-
* // Search an instance
|
|
10106
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10107
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10108
|
-
* ai_search_options: {
|
|
10109
|
-
* retrieval: { max_num_results: 10 }
|
|
10110
|
-
* }
|
|
10111
|
-
* });
|
|
10112
|
-
*
|
|
10113
|
-
* // Generate chat completions with AI Search context
|
|
10114
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10115
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10116
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10117
|
-
* });
|
|
10118
|
-
* ```
|
|
10392
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10393
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10119
10394
|
*/
|
|
10120
|
-
aiSearch():
|
|
10395
|
+
aiSearch(): AiSearchNamespace;
|
|
10121
10396
|
/**
|
|
10122
10397
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10123
|
-
* Use `
|
|
10124
|
-
*
|
|
10125
|
-
* Migration guide:
|
|
10126
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10127
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10128
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10398
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10399
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10129
10400
|
*
|
|
10130
|
-
*
|
|
10131
|
-
*
|
|
10132
|
-
* @see AiSearchAccountService
|
|
10133
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10401
|
+
* @param autoragId Instance ID
|
|
10134
10402
|
*/
|
|
10135
10403
|
autorag(autoragId: string): AutoRAG;
|
|
10136
10404
|
run<
|
|
@@ -10289,22 +10557,23 @@ declare abstract class AiGateway {
|
|
|
10289
10557
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10290
10558
|
}
|
|
10291
10559
|
/**
|
|
10292
|
-
* @deprecated
|
|
10293
|
-
*
|
|
10560
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10561
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10294
10562
|
*/
|
|
10295
10563
|
interface AutoRAGInternalError extends Error {}
|
|
10296
10564
|
/**
|
|
10297
|
-
* @deprecated
|
|
10298
|
-
*
|
|
10565
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10566
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10299
10567
|
*/
|
|
10300
10568
|
interface AutoRAGNotFoundError extends Error {}
|
|
10301
10569
|
/**
|
|
10302
|
-
* @deprecated
|
|
10570
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10571
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10303
10572
|
*/
|
|
10304
10573
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10305
10574
|
/**
|
|
10306
|
-
* @deprecated
|
|
10307
|
-
*
|
|
10575
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10576
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10308
10577
|
*/
|
|
10309
10578
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10310
10579
|
type ComparisonFilter = {
|
|
@@ -10317,9 +10586,8 @@ type CompoundFilter = {
|
|
|
10317
10586
|
filters: ComparisonFilter[];
|
|
10318
10587
|
};
|
|
10319
10588
|
/**
|
|
10320
|
-
* @deprecated
|
|
10321
|
-
*
|
|
10322
|
-
* @see AiSearchSearchRequest
|
|
10589
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10590
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10323
10591
|
*/
|
|
10324
10592
|
type AutoRagSearchRequest = {
|
|
10325
10593
|
query: string;
|
|
@@ -10336,18 +10604,16 @@ type AutoRagSearchRequest = {
|
|
|
10336
10604
|
rewrite_query?: boolean;
|
|
10337
10605
|
};
|
|
10338
10606
|
/**
|
|
10339
|
-
* @deprecated
|
|
10340
|
-
*
|
|
10341
|
-
* @see AiSearchChatCompletionsRequest
|
|
10607
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10608
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10342
10609
|
*/
|
|
10343
10610
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10344
10611
|
stream?: boolean;
|
|
10345
10612
|
system_prompt?: string;
|
|
10346
10613
|
};
|
|
10347
10614
|
/**
|
|
10348
|
-
* @deprecated
|
|
10349
|
-
*
|
|
10350
|
-
* @see AiSearchChatCompletionsRequest
|
|
10615
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10616
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10351
10617
|
*/
|
|
10352
10618
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10353
10619
|
AutoRagAiSearchRequest,
|
|
@@ -10356,9 +10622,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10356
10622
|
stream: true;
|
|
10357
10623
|
};
|
|
10358
10624
|
/**
|
|
10359
|
-
* @deprecated
|
|
10360
|
-
*
|
|
10361
|
-
* @see AiSearchSearchResponse
|
|
10625
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10626
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10362
10627
|
*/
|
|
10363
10628
|
type AutoRagSearchResponse = {
|
|
10364
10629
|
object: "vector_store.search_results.page";
|
|
@@ -10377,9 +10642,8 @@ type AutoRagSearchResponse = {
|
|
|
10377
10642
|
next_page: string | null;
|
|
10378
10643
|
};
|
|
10379
10644
|
/**
|
|
10380
|
-
* @deprecated
|
|
10381
|
-
*
|
|
10382
|
-
* @see AiSearchListResponse
|
|
10645
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10646
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10383
10647
|
*/
|
|
10384
10648
|
type AutoRagListResponse = {
|
|
10385
10649
|
id: string;
|
|
@@ -10391,49 +10655,40 @@ type AutoRagListResponse = {
|
|
|
10391
10655
|
status: string;
|
|
10392
10656
|
}[];
|
|
10393
10657
|
/**
|
|
10394
|
-
* @deprecated
|
|
10395
|
-
*
|
|
10658
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10659
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10396
10660
|
*/
|
|
10397
10661
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10398
10662
|
response: string;
|
|
10399
10663
|
};
|
|
10400
10664
|
/**
|
|
10401
|
-
* @deprecated
|
|
10402
|
-
*
|
|
10403
|
-
*
|
|
10404
|
-
* Migration guide:
|
|
10405
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10406
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10407
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10408
|
-
*
|
|
10409
|
-
* @see AiSearchAccountService
|
|
10410
|
-
* @see AiSearchInstanceService
|
|
10665
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10666
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10411
10667
|
*/
|
|
10412
10668
|
declare abstract class AutoRAG {
|
|
10413
10669
|
/**
|
|
10414
|
-
* @deprecated Use
|
|
10415
|
-
*
|
|
10670
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10671
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10416
10672
|
*/
|
|
10417
10673
|
list(): Promise<AutoRagListResponse>;
|
|
10418
10674
|
/**
|
|
10419
|
-
* @deprecated Use
|
|
10420
|
-
*
|
|
10421
|
-
* @see AiSearchInstanceService.search
|
|
10675
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10676
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10422
10677
|
*/
|
|
10423
10678
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10424
10679
|
/**
|
|
10425
|
-
* @deprecated Use
|
|
10426
|
-
*
|
|
10680
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10681
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10427
10682
|
*/
|
|
10428
10683
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10429
10684
|
/**
|
|
10430
|
-
* @deprecated Use
|
|
10431
|
-
*
|
|
10685
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10686
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10432
10687
|
*/
|
|
10433
10688
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10434
10689
|
/**
|
|
10435
|
-
* @deprecated Use
|
|
10436
|
-
*
|
|
10690
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10691
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10437
10692
|
*/
|
|
10438
10693
|
aiSearch(
|
|
10439
10694
|
params: AutoRagAiSearchRequest,
|