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