@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-08-04/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;
|
|
@@ -3864,11 +3870,10 @@ declare abstract class Performance {
|
|
|
3864
3870
|
*/
|
|
3865
3871
|
toJSON(): object;
|
|
3866
3872
|
}
|
|
3867
|
-
// AI Search
|
|
3873
|
+
// ============ AI Search Error Interfaces ============
|
|
3868
3874
|
interface AiSearchInternalError extends Error {}
|
|
3869
3875
|
interface AiSearchNotFoundError extends Error {}
|
|
3870
|
-
|
|
3871
|
-
// AI Search V2 Request Types
|
|
3876
|
+
// ============ AI Search Request Types ============
|
|
3872
3877
|
type AiSearchSearchRequest = {
|
|
3873
3878
|
messages: Array<{
|
|
3874
3879
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3893,9 +3898,8 @@ type AiSearchSearchRequest = {
|
|
|
3893
3898
|
[key: string]: unknown;
|
|
3894
3899
|
};
|
|
3895
3900
|
reranking?: {
|
|
3896
|
-
/** Enable reranking (default false) */
|
|
3897
3901
|
enabled?: boolean;
|
|
3898
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3902
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3899
3903
|
/** Match threshold (0-1, default 0.4) */
|
|
3900
3904
|
match_threshold?: number;
|
|
3901
3905
|
[key: string]: unknown;
|
|
@@ -3907,6 +3911,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3907
3911
|
messages: Array<{
|
|
3908
3912
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3909
3913
|
content: string | null;
|
|
3914
|
+
[key: string]: unknown;
|
|
3910
3915
|
}>;
|
|
3911
3916
|
model?: string;
|
|
3912
3917
|
stream?: boolean;
|
|
@@ -3927,7 +3932,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3927
3932
|
};
|
|
3928
3933
|
reranking?: {
|
|
3929
3934
|
enabled?: boolean;
|
|
3930
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3935
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3931
3936
|
match_threshold?: number;
|
|
3932
3937
|
[key: string]: unknown;
|
|
3933
3938
|
};
|
|
@@ -3935,7 +3940,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3935
3940
|
};
|
|
3936
3941
|
[key: string]: unknown;
|
|
3937
3942
|
};
|
|
3938
|
-
// AI Search
|
|
3943
|
+
// ============ AI Search Response Types ============
|
|
3939
3944
|
type AiSearchSearchResponse = {
|
|
3940
3945
|
search_query: string;
|
|
3941
3946
|
chunks: Array<{
|
|
@@ -3954,26 +3959,65 @@ type AiSearchSearchResponse = {
|
|
|
3954
3959
|
keyword_score?: number;
|
|
3955
3960
|
/** Vector similarity score (0-1) */
|
|
3956
3961
|
vector_score?: number;
|
|
3962
|
+
[key: string]: unknown;
|
|
3963
|
+
};
|
|
3964
|
+
}>;
|
|
3965
|
+
};
|
|
3966
|
+
type AiSearchChatCompletionsResponse = {
|
|
3967
|
+
id?: string;
|
|
3968
|
+
object?: string;
|
|
3969
|
+
model?: string;
|
|
3970
|
+
choices: Array<{
|
|
3971
|
+
index?: number;
|
|
3972
|
+
message: {
|
|
3973
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3974
|
+
content: string | null;
|
|
3975
|
+
[key: string]: unknown;
|
|
3957
3976
|
};
|
|
3977
|
+
[key: string]: unknown;
|
|
3958
3978
|
}>;
|
|
3979
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
3980
|
+
[key: string]: unknown;
|
|
3959
3981
|
};
|
|
3960
|
-
type
|
|
3982
|
+
type AiSearchStatsResponse = {
|
|
3983
|
+
queued?: number;
|
|
3984
|
+
running?: number;
|
|
3985
|
+
completed?: number;
|
|
3986
|
+
error?: number;
|
|
3987
|
+
skipped?: number;
|
|
3988
|
+
outdated?: number;
|
|
3989
|
+
last_activity?: string;
|
|
3990
|
+
};
|
|
3991
|
+
// ============ AI Search Instance Info Types ============
|
|
3992
|
+
type AiSearchInstanceInfo = {
|
|
3961
3993
|
id: string;
|
|
3962
|
-
|
|
3963
|
-
account_id?: string;
|
|
3964
|
-
account_tag?: string;
|
|
3965
|
-
/** Whether the instance is enabled (default true) */
|
|
3966
|
-
enable?: boolean;
|
|
3967
|
-
type?: "r2" | "web-crawler";
|
|
3994
|
+
type?: "r2" | "web-crawler" | string;
|
|
3968
3995
|
source?: string;
|
|
3996
|
+
paused?: boolean;
|
|
3997
|
+
status?: string;
|
|
3998
|
+
namespace?: string;
|
|
3999
|
+
created_at?: string;
|
|
4000
|
+
modified_at?: string;
|
|
3969
4001
|
[key: string]: unknown;
|
|
3970
|
-
}
|
|
4002
|
+
};
|
|
4003
|
+
type AiSearchListResponse = {
|
|
4004
|
+
result: AiSearchInstanceInfo[];
|
|
4005
|
+
result_info?: {
|
|
4006
|
+
count: number;
|
|
4007
|
+
page: number;
|
|
4008
|
+
per_page: number;
|
|
4009
|
+
total_count: number;
|
|
4010
|
+
};
|
|
4011
|
+
};
|
|
4012
|
+
// ============ AI Search Config Types ============
|
|
3971
4013
|
type AiSearchConfig = {
|
|
3972
4014
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3973
4015
|
id: string;
|
|
3974
|
-
type
|
|
3975
|
-
|
|
3976
|
-
|
|
4016
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4017
|
+
type?: "r2" | "web-crawler" | string;
|
|
4018
|
+
/** Source URL (required for web-crawler type). */
|
|
4019
|
+
source?: string;
|
|
4020
|
+
source_params?: unknown;
|
|
3977
4021
|
/** Token ID (UUID format) */
|
|
3978
4022
|
token_id?: string;
|
|
3979
4023
|
ai_gateway_id?: string;
|
|
@@ -3983,54 +4027,307 @@ type AiSearchConfig = {
|
|
|
3983
4027
|
reranking?: boolean;
|
|
3984
4028
|
embedding_model?: string;
|
|
3985
4029
|
ai_search_model?: string;
|
|
4030
|
+
[key: string]: unknown;
|
|
3986
4031
|
};
|
|
3987
|
-
|
|
4032
|
+
// ============ AI Search Item Types ============
|
|
4033
|
+
type AiSearchItemInfo = {
|
|
3988
4034
|
id: string;
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
4035
|
+
key: string;
|
|
4036
|
+
status:
|
|
4037
|
+
| "completed"
|
|
4038
|
+
| "error"
|
|
4039
|
+
| "skipped"
|
|
4040
|
+
| "queued"
|
|
4041
|
+
| "processing"
|
|
4042
|
+
| "outdated";
|
|
4043
|
+
metadata?: Record<string, unknown>;
|
|
3992
4044
|
[key: string]: unknown;
|
|
3993
4045
|
};
|
|
3994
|
-
|
|
3995
|
-
|
|
4046
|
+
type AiSearchItemContentResult = {
|
|
4047
|
+
body: ReadableStream;
|
|
4048
|
+
contentType: string;
|
|
4049
|
+
filename: string;
|
|
4050
|
+
size: number;
|
|
4051
|
+
};
|
|
4052
|
+
type AiSearchUploadItemOptions = {
|
|
4053
|
+
metadata?: Record<string, unknown>;
|
|
4054
|
+
};
|
|
4055
|
+
type AiSearchListItemsParams = {
|
|
4056
|
+
page?: number;
|
|
4057
|
+
per_page?: number;
|
|
4058
|
+
};
|
|
4059
|
+
type AiSearchListItemsResponse = {
|
|
4060
|
+
result: AiSearchItemInfo[];
|
|
4061
|
+
result_info?: {
|
|
4062
|
+
count: number;
|
|
4063
|
+
page: number;
|
|
4064
|
+
per_page: number;
|
|
4065
|
+
total_count: number;
|
|
4066
|
+
};
|
|
4067
|
+
};
|
|
4068
|
+
// ============ AI Search Job Types ============
|
|
4069
|
+
type AiSearchJobInfo = {
|
|
4070
|
+
id: string;
|
|
4071
|
+
source: "user" | "schedule";
|
|
4072
|
+
description?: string;
|
|
4073
|
+
last_seen_at?: string;
|
|
4074
|
+
started_at?: string;
|
|
4075
|
+
ended_at?: string;
|
|
4076
|
+
end_reason?: string;
|
|
4077
|
+
};
|
|
4078
|
+
type AiSearchJobLog = {
|
|
4079
|
+
id: number;
|
|
4080
|
+
message: string;
|
|
4081
|
+
message_type: number;
|
|
4082
|
+
created_at: number;
|
|
4083
|
+
};
|
|
4084
|
+
type AiSearchCreateJobParams = {
|
|
4085
|
+
description?: string;
|
|
4086
|
+
};
|
|
4087
|
+
type AiSearchListJobsParams = {
|
|
4088
|
+
page?: number;
|
|
4089
|
+
per_page?: number;
|
|
4090
|
+
};
|
|
4091
|
+
type AiSearchListJobsResponse = {
|
|
4092
|
+
result: AiSearchJobInfo[];
|
|
4093
|
+
result_info?: {
|
|
4094
|
+
count: number;
|
|
4095
|
+
page: number;
|
|
4096
|
+
per_page: number;
|
|
4097
|
+
total_count: number;
|
|
4098
|
+
};
|
|
4099
|
+
};
|
|
4100
|
+
type AiSearchJobLogsParams = {
|
|
4101
|
+
page?: number;
|
|
4102
|
+
per_page?: number;
|
|
4103
|
+
};
|
|
4104
|
+
type AiSearchJobLogsResponse = {
|
|
4105
|
+
result: AiSearchJobLog[];
|
|
4106
|
+
result_info?: {
|
|
4107
|
+
count: number;
|
|
4108
|
+
page: number;
|
|
4109
|
+
per_page: number;
|
|
4110
|
+
total_count: number;
|
|
4111
|
+
};
|
|
4112
|
+
};
|
|
4113
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4114
|
+
/**
|
|
4115
|
+
* Single item service for an AI Search instance.
|
|
4116
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4117
|
+
*/
|
|
4118
|
+
declare abstract class AiSearchItem {
|
|
4119
|
+
/** Get metadata about this item. */
|
|
4120
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4121
|
+
/**
|
|
4122
|
+
* Download the item's content.
|
|
4123
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4124
|
+
*/
|
|
4125
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4126
|
+
}
|
|
4127
|
+
/**
|
|
4128
|
+
* Items collection service for an AI Search instance.
|
|
4129
|
+
* Provides list, upload, and access to individual items.
|
|
4130
|
+
*/
|
|
4131
|
+
declare abstract class AiSearchItems {
|
|
4132
|
+
/** List items in this instance. */
|
|
4133
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4134
|
+
/**
|
|
4135
|
+
* Upload a file as an item.
|
|
4136
|
+
* @param name Filename for the uploaded item.
|
|
4137
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4138
|
+
* @param options Optional metadata to attach to the item.
|
|
4139
|
+
* @returns The created item info.
|
|
4140
|
+
*/
|
|
4141
|
+
upload(
|
|
4142
|
+
name: string,
|
|
4143
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4144
|
+
options?: AiSearchUploadItemOptions,
|
|
4145
|
+
): Promise<AiSearchItemInfo>;
|
|
4146
|
+
/**
|
|
4147
|
+
* Upload a file and poll until processing completes.
|
|
4148
|
+
* @param name Filename for the uploaded item.
|
|
4149
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4150
|
+
* @param options Optional metadata to attach to the item.
|
|
4151
|
+
* @returns The item info after processing completes (or timeout).
|
|
4152
|
+
*/
|
|
4153
|
+
uploadAndPoll(
|
|
4154
|
+
name: string,
|
|
4155
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4156
|
+
options?: AiSearchUploadItemOptions,
|
|
4157
|
+
): Promise<AiSearchItemInfo>;
|
|
4158
|
+
/**
|
|
4159
|
+
* Get an item by ID.
|
|
4160
|
+
* @param itemId The item identifier.
|
|
4161
|
+
* @returns Item service for info, delete, and download operations.
|
|
4162
|
+
*/
|
|
4163
|
+
get(itemId: string): AiSearchItem;
|
|
4164
|
+
/** Delete this item from the instance.
|
|
4165
|
+
* @param itemId The item identifier.
|
|
4166
|
+
*/
|
|
4167
|
+
delete(itemId: string): Promise<void>;
|
|
4168
|
+
}
|
|
4169
|
+
/**
|
|
4170
|
+
* Single job service for an AI Search instance.
|
|
4171
|
+
* Provides info and logs for a specific job.
|
|
4172
|
+
*/
|
|
4173
|
+
declare abstract class AiSearchJob {
|
|
4174
|
+
/** Get metadata about this job. */
|
|
4175
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4176
|
+
/** Get logs for this job. */
|
|
4177
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4180
|
+
* Jobs collection service for an AI Search instance.
|
|
4181
|
+
* Provides list, create, and access to individual jobs.
|
|
4182
|
+
*/
|
|
4183
|
+
declare abstract class AiSearchJobs {
|
|
4184
|
+
/** List jobs for this instance. */
|
|
4185
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4186
|
+
/**
|
|
4187
|
+
* Create a new indexing job.
|
|
4188
|
+
* @param params Optional job parameters.
|
|
4189
|
+
* @returns The created job info.
|
|
4190
|
+
*/
|
|
4191
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4192
|
+
/**
|
|
4193
|
+
* Get a job by ID.
|
|
4194
|
+
* @param jobId The job identifier.
|
|
4195
|
+
* @returns Job service for info and logs operations.
|
|
4196
|
+
*/
|
|
4197
|
+
get(jobId: string): AiSearchJob;
|
|
4198
|
+
}
|
|
4199
|
+
// ============ AI Search Binding Classes ============
|
|
4200
|
+
/**
|
|
4201
|
+
* Instance-level AI Search service.
|
|
4202
|
+
*
|
|
4203
|
+
* Used as:
|
|
4204
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4205
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4206
|
+
*
|
|
4207
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4208
|
+
*
|
|
4209
|
+
* @example
|
|
4210
|
+
* ```ts
|
|
4211
|
+
* // Via namespace binding
|
|
4212
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4213
|
+
* const results = await instance.search({
|
|
4214
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4215
|
+
* });
|
|
4216
|
+
*
|
|
4217
|
+
* // Via single instance binding
|
|
4218
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4219
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4220
|
+
* });
|
|
4221
|
+
* ```
|
|
4222
|
+
*/
|
|
4223
|
+
declare abstract class AiSearchInstance {
|
|
3996
4224
|
/**
|
|
3997
4225
|
* Search the AI Search instance for relevant chunks.
|
|
3998
|
-
* @param params Search request with messages and AI search options
|
|
3999
|
-
* @returns Search response with matching chunks
|
|
4226
|
+
* @param params Search request with messages and optional AI search options.
|
|
4227
|
+
* @returns Search response with matching chunks and search query.
|
|
4000
4228
|
*/
|
|
4001
4229
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4230
|
+
/**
|
|
4231
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4232
|
+
* @param params Chat completions request with stream: true.
|
|
4233
|
+
* @returns ReadableStream of server-sent events.
|
|
4234
|
+
*/
|
|
4235
|
+
chatCompletions(
|
|
4236
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4237
|
+
stream: true;
|
|
4238
|
+
},
|
|
4239
|
+
): Promise<ReadableStream>;
|
|
4002
4240
|
/**
|
|
4003
4241
|
* Generate chat completions with AI Search context.
|
|
4004
|
-
* @param params Chat completions request
|
|
4005
|
-
* @returns
|
|
4242
|
+
* @param params Chat completions request.
|
|
4243
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4006
4244
|
*/
|
|
4007
4245
|
chatCompletions(
|
|
4008
4246
|
params: AiSearchChatCompletionsRequest,
|
|
4009
|
-
): Promise<
|
|
4247
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4010
4248
|
/**
|
|
4011
|
-
*
|
|
4249
|
+
* Update the instance configuration.
|
|
4250
|
+
* @param config Partial configuration to update.
|
|
4251
|
+
* @returns Updated instance info.
|
|
4012
4252
|
*/
|
|
4013
|
-
|
|
4253
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4254
|
+
/** Get metadata about this instance. */
|
|
4255
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4256
|
+
/**
|
|
4257
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4258
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4259
|
+
*/
|
|
4260
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4261
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4262
|
+
get items(): AiSearchItems;
|
|
4263
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4264
|
+
get jobs(): AiSearchJobs;
|
|
4014
4265
|
}
|
|
4015
|
-
|
|
4016
|
-
|
|
4266
|
+
/**
|
|
4267
|
+
* Namespace-level AI Search service.
|
|
4268
|
+
*
|
|
4269
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4270
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4271
|
+
*
|
|
4272
|
+
* @example
|
|
4273
|
+
* ```ts
|
|
4274
|
+
* // Access an instance within the namespace
|
|
4275
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4276
|
+
* const results = await blog.search({
|
|
4277
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4278
|
+
* });
|
|
4279
|
+
*
|
|
4280
|
+
* // List all instances in the namespace
|
|
4281
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4282
|
+
*
|
|
4283
|
+
* // Create a new instance with built-in storage
|
|
4284
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4285
|
+
* id: "tenant-123",
|
|
4286
|
+
* });
|
|
4287
|
+
*
|
|
4288
|
+
* // Upload items into the instance
|
|
4289
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4290
|
+
*
|
|
4291
|
+
* // Delete an instance
|
|
4292
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4293
|
+
* ```
|
|
4294
|
+
*/
|
|
4295
|
+
declare abstract class AiSearchNamespace {
|
|
4017
4296
|
/**
|
|
4018
|
-
*
|
|
4019
|
-
* @
|
|
4297
|
+
* Get an instance by name within the bound namespace.
|
|
4298
|
+
* @param name Instance name.
|
|
4299
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4300
|
+
*/
|
|
4301
|
+
get(name: string): AiSearchInstance;
|
|
4302
|
+
/**
|
|
4303
|
+
* List all instances in the bound namespace.
|
|
4304
|
+
* @returns Array of instance metadata.
|
|
4020
4305
|
*/
|
|
4021
4306
|
list(): Promise<AiSearchListResponse>;
|
|
4022
4307
|
/**
|
|
4023
|
-
*
|
|
4024
|
-
* @param
|
|
4025
|
-
* @returns Instance service for
|
|
4308
|
+
* Create a new instance within the bound namespace.
|
|
4309
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4310
|
+
* @returns Instance service for the newly created instance.
|
|
4311
|
+
*
|
|
4312
|
+
* @example
|
|
4313
|
+
* ```ts
|
|
4314
|
+
* // Create with built-in storage (upload items manually)
|
|
4315
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4316
|
+
*
|
|
4317
|
+
* // Create with web crawler source
|
|
4318
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4319
|
+
* id: "docs-search",
|
|
4320
|
+
* type: "web-crawler",
|
|
4321
|
+
* source: "https://developers.cloudflare.com",
|
|
4322
|
+
* });
|
|
4323
|
+
* ```
|
|
4026
4324
|
*/
|
|
4027
|
-
|
|
4325
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4028
4326
|
/**
|
|
4029
|
-
*
|
|
4030
|
-
* @param
|
|
4031
|
-
* @returns Instance service for performing operations
|
|
4327
|
+
* Delete an instance from the bound namespace.
|
|
4328
|
+
* @param name Instance name to delete.
|
|
4032
4329
|
*/
|
|
4033
|
-
|
|
4330
|
+
delete(name: string): Promise<void>;
|
|
4034
4331
|
}
|
|
4035
4332
|
type AiImageClassificationInput = {
|
|
4036
4333
|
image: number[];
|
|
@@ -10028,6 +10325,7 @@ type AiOptions = {
|
|
|
10028
10325
|
returnRawResponse?: boolean;
|
|
10029
10326
|
prefix?: string;
|
|
10030
10327
|
extraHeaders?: object;
|
|
10328
|
+
signal?: AbortSignal;
|
|
10031
10329
|
};
|
|
10032
10330
|
type AiModelsSearchParams = {
|
|
10033
10331
|
author?: string;
|
|
@@ -10071,46 +10369,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
10071
10369
|
aiGatewayLogId: string | null;
|
|
10072
10370
|
gateway(gatewayId: string): AiGateway;
|
|
10073
10371
|
/**
|
|
10074
|
-
*
|
|
10075
|
-
*
|
|
10076
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10077
|
-
* - Account-level operations: `list()`, `create()`
|
|
10078
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10079
|
-
*
|
|
10080
|
-
* @example
|
|
10081
|
-
* ```typescript
|
|
10082
|
-
* // List all AI Search instances
|
|
10083
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10084
|
-
*
|
|
10085
|
-
* // Search an instance
|
|
10086
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10087
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10088
|
-
* ai_search_options: {
|
|
10089
|
-
* retrieval: { max_num_results: 10 }
|
|
10090
|
-
* }
|
|
10091
|
-
* });
|
|
10092
|
-
*
|
|
10093
|
-
* // Generate chat completions with AI Search context
|
|
10094
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10095
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10096
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10097
|
-
* });
|
|
10098
|
-
* ```
|
|
10372
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10373
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10099
10374
|
*/
|
|
10100
|
-
aiSearch():
|
|
10375
|
+
aiSearch(): AiSearchNamespace;
|
|
10101
10376
|
/**
|
|
10102
10377
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10103
|
-
* Use `
|
|
10104
|
-
*
|
|
10105
|
-
* Migration guide:
|
|
10106
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10107
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10108
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10378
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10379
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10109
10380
|
*
|
|
10110
|
-
*
|
|
10111
|
-
*
|
|
10112
|
-
* @see AiSearchAccountService
|
|
10113
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10381
|
+
* @param autoragId Instance ID
|
|
10114
10382
|
*/
|
|
10115
10383
|
autorag(autoragId: string): AutoRAG;
|
|
10116
10384
|
run<
|
|
@@ -10269,22 +10537,23 @@ declare abstract class AiGateway {
|
|
|
10269
10537
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10270
10538
|
}
|
|
10271
10539
|
/**
|
|
10272
|
-
* @deprecated
|
|
10273
|
-
*
|
|
10540
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10541
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10274
10542
|
*/
|
|
10275
10543
|
interface AutoRAGInternalError extends Error {}
|
|
10276
10544
|
/**
|
|
10277
|
-
* @deprecated
|
|
10278
|
-
*
|
|
10545
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10546
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10279
10547
|
*/
|
|
10280
10548
|
interface AutoRAGNotFoundError extends Error {}
|
|
10281
10549
|
/**
|
|
10282
|
-
* @deprecated
|
|
10550
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10551
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10283
10552
|
*/
|
|
10284
10553
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10285
10554
|
/**
|
|
10286
|
-
* @deprecated
|
|
10287
|
-
*
|
|
10555
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10556
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10288
10557
|
*/
|
|
10289
10558
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10290
10559
|
type ComparisonFilter = {
|
|
@@ -10297,9 +10566,8 @@ type CompoundFilter = {
|
|
|
10297
10566
|
filters: ComparisonFilter[];
|
|
10298
10567
|
};
|
|
10299
10568
|
/**
|
|
10300
|
-
* @deprecated
|
|
10301
|
-
*
|
|
10302
|
-
* @see AiSearchSearchRequest
|
|
10569
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10570
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10303
10571
|
*/
|
|
10304
10572
|
type AutoRagSearchRequest = {
|
|
10305
10573
|
query: string;
|
|
@@ -10316,18 +10584,16 @@ type AutoRagSearchRequest = {
|
|
|
10316
10584
|
rewrite_query?: boolean;
|
|
10317
10585
|
};
|
|
10318
10586
|
/**
|
|
10319
|
-
* @deprecated
|
|
10320
|
-
*
|
|
10321
|
-
* @see AiSearchChatCompletionsRequest
|
|
10587
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10588
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10322
10589
|
*/
|
|
10323
10590
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10324
10591
|
stream?: boolean;
|
|
10325
10592
|
system_prompt?: string;
|
|
10326
10593
|
};
|
|
10327
10594
|
/**
|
|
10328
|
-
* @deprecated
|
|
10329
|
-
*
|
|
10330
|
-
* @see AiSearchChatCompletionsRequest
|
|
10595
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10596
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10331
10597
|
*/
|
|
10332
10598
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10333
10599
|
AutoRagAiSearchRequest,
|
|
@@ -10336,9 +10602,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10336
10602
|
stream: true;
|
|
10337
10603
|
};
|
|
10338
10604
|
/**
|
|
10339
|
-
* @deprecated
|
|
10340
|
-
*
|
|
10341
|
-
* @see AiSearchSearchResponse
|
|
10605
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10606
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10342
10607
|
*/
|
|
10343
10608
|
type AutoRagSearchResponse = {
|
|
10344
10609
|
object: "vector_store.search_results.page";
|
|
@@ -10357,9 +10622,8 @@ type AutoRagSearchResponse = {
|
|
|
10357
10622
|
next_page: string | null;
|
|
10358
10623
|
};
|
|
10359
10624
|
/**
|
|
10360
|
-
* @deprecated
|
|
10361
|
-
*
|
|
10362
|
-
* @see AiSearchListResponse
|
|
10625
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10626
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10363
10627
|
*/
|
|
10364
10628
|
type AutoRagListResponse = {
|
|
10365
10629
|
id: string;
|
|
@@ -10371,49 +10635,40 @@ type AutoRagListResponse = {
|
|
|
10371
10635
|
status: string;
|
|
10372
10636
|
}[];
|
|
10373
10637
|
/**
|
|
10374
|
-
* @deprecated
|
|
10375
|
-
*
|
|
10638
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10639
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10376
10640
|
*/
|
|
10377
10641
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10378
10642
|
response: string;
|
|
10379
10643
|
};
|
|
10380
10644
|
/**
|
|
10381
|
-
* @deprecated
|
|
10382
|
-
*
|
|
10383
|
-
*
|
|
10384
|
-
* Migration guide:
|
|
10385
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10386
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10387
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10388
|
-
*
|
|
10389
|
-
* @see AiSearchAccountService
|
|
10390
|
-
* @see AiSearchInstanceService
|
|
10645
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10646
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10391
10647
|
*/
|
|
10392
10648
|
declare abstract class AutoRAG {
|
|
10393
10649
|
/**
|
|
10394
|
-
* @deprecated Use
|
|
10395
|
-
*
|
|
10650
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10651
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10396
10652
|
*/
|
|
10397
10653
|
list(): Promise<AutoRagListResponse>;
|
|
10398
10654
|
/**
|
|
10399
|
-
* @deprecated Use
|
|
10400
|
-
*
|
|
10401
|
-
* @see AiSearchInstanceService.search
|
|
10655
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10656
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10402
10657
|
*/
|
|
10403
10658
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10404
10659
|
/**
|
|
10405
|
-
* @deprecated Use
|
|
10406
|
-
*
|
|
10660
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10661
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10407
10662
|
*/
|
|
10408
10663
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10409
10664
|
/**
|
|
10410
|
-
* @deprecated Use
|
|
10411
|
-
*
|
|
10665
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10666
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10412
10667
|
*/
|
|
10413
10668
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10414
10669
|
/**
|
|
10415
|
-
* @deprecated Use
|
|
10416
|
-
*
|
|
10670
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10671
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10417
10672
|
*/
|
|
10418
10673
|
aiSearch(
|
|
10419
10674
|
params: AutoRagAiSearchRequest,
|