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