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