@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/2021-11-03/index.d.ts
CHANGED
|
@@ -3076,6 +3076,11 @@ interface QueuingStrategyInit {
|
|
|
3076
3076
|
*/
|
|
3077
3077
|
highWaterMark: number;
|
|
3078
3078
|
}
|
|
3079
|
+
interface TracePreviewInfo {
|
|
3080
|
+
id: string;
|
|
3081
|
+
slug: string;
|
|
3082
|
+
name: string;
|
|
3083
|
+
}
|
|
3079
3084
|
interface ScriptVersion {
|
|
3080
3085
|
id?: string;
|
|
3081
3086
|
tag?: string;
|
|
@@ -3110,6 +3115,7 @@ interface TraceItem {
|
|
|
3110
3115
|
readonly dispatchNamespace?: string;
|
|
3111
3116
|
readonly scriptTags?: string[];
|
|
3112
3117
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3118
|
+
readonly preview?: TracePreviewInfo;
|
|
3113
3119
|
readonly durableObjectId?: string;
|
|
3114
3120
|
readonly outcome: string;
|
|
3115
3121
|
readonly executionModel: string;
|
|
@@ -3788,11 +3794,10 @@ declare abstract class Performance {
|
|
|
3788
3794
|
*/
|
|
3789
3795
|
toJSON(): object;
|
|
3790
3796
|
}
|
|
3791
|
-
// AI Search
|
|
3797
|
+
// ============ AI Search Error Interfaces ============
|
|
3792
3798
|
interface AiSearchInternalError extends Error {}
|
|
3793
3799
|
interface AiSearchNotFoundError extends Error {}
|
|
3794
|
-
|
|
3795
|
-
// AI Search V2 Request Types
|
|
3800
|
+
// ============ AI Search Request Types ============
|
|
3796
3801
|
type AiSearchSearchRequest = {
|
|
3797
3802
|
messages: Array<{
|
|
3798
3803
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -3817,9 +3822,8 @@ type AiSearchSearchRequest = {
|
|
|
3817
3822
|
[key: string]: unknown;
|
|
3818
3823
|
};
|
|
3819
3824
|
reranking?: {
|
|
3820
|
-
/** Enable reranking (default false) */
|
|
3821
3825
|
enabled?: boolean;
|
|
3822
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3826
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3823
3827
|
/** Match threshold (0-1, default 0.4) */
|
|
3824
3828
|
match_threshold?: number;
|
|
3825
3829
|
[key: string]: unknown;
|
|
@@ -3831,6 +3835,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3831
3835
|
messages: Array<{
|
|
3832
3836
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3833
3837
|
content: string | null;
|
|
3838
|
+
[key: string]: unknown;
|
|
3834
3839
|
}>;
|
|
3835
3840
|
model?: string;
|
|
3836
3841
|
stream?: boolean;
|
|
@@ -3851,7 +3856,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3851
3856
|
};
|
|
3852
3857
|
reranking?: {
|
|
3853
3858
|
enabled?: boolean;
|
|
3854
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
3859
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
3855
3860
|
match_threshold?: number;
|
|
3856
3861
|
[key: string]: unknown;
|
|
3857
3862
|
};
|
|
@@ -3859,7 +3864,7 @@ type AiSearchChatCompletionsRequest = {
|
|
|
3859
3864
|
};
|
|
3860
3865
|
[key: string]: unknown;
|
|
3861
3866
|
};
|
|
3862
|
-
// AI Search
|
|
3867
|
+
// ============ AI Search Response Types ============
|
|
3863
3868
|
type AiSearchSearchResponse = {
|
|
3864
3869
|
search_query: string;
|
|
3865
3870
|
chunks: Array<{
|
|
@@ -3878,26 +3883,65 @@ type AiSearchSearchResponse = {
|
|
|
3878
3883
|
keyword_score?: number;
|
|
3879
3884
|
/** Vector similarity score (0-1) */
|
|
3880
3885
|
vector_score?: number;
|
|
3886
|
+
[key: string]: unknown;
|
|
3887
|
+
};
|
|
3888
|
+
}>;
|
|
3889
|
+
};
|
|
3890
|
+
type AiSearchChatCompletionsResponse = {
|
|
3891
|
+
id?: string;
|
|
3892
|
+
object?: string;
|
|
3893
|
+
model?: string;
|
|
3894
|
+
choices: Array<{
|
|
3895
|
+
index?: number;
|
|
3896
|
+
message: {
|
|
3897
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
3898
|
+
content: string | null;
|
|
3899
|
+
[key: string]: unknown;
|
|
3881
3900
|
};
|
|
3901
|
+
[key: string]: unknown;
|
|
3882
3902
|
}>;
|
|
3903
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
3904
|
+
[key: string]: unknown;
|
|
3883
3905
|
};
|
|
3884
|
-
type
|
|
3906
|
+
type AiSearchStatsResponse = {
|
|
3907
|
+
queued?: number;
|
|
3908
|
+
running?: number;
|
|
3909
|
+
completed?: number;
|
|
3910
|
+
error?: number;
|
|
3911
|
+
skipped?: number;
|
|
3912
|
+
outdated?: number;
|
|
3913
|
+
last_activity?: string;
|
|
3914
|
+
};
|
|
3915
|
+
// ============ AI Search Instance Info Types ============
|
|
3916
|
+
type AiSearchInstanceInfo = {
|
|
3885
3917
|
id: string;
|
|
3886
|
-
|
|
3887
|
-
account_id?: string;
|
|
3888
|
-
account_tag?: string;
|
|
3889
|
-
/** Whether the instance is enabled (default true) */
|
|
3890
|
-
enable?: boolean;
|
|
3891
|
-
type?: "r2" | "web-crawler";
|
|
3918
|
+
type?: "r2" | "web-crawler" | string;
|
|
3892
3919
|
source?: string;
|
|
3920
|
+
paused?: boolean;
|
|
3921
|
+
status?: string;
|
|
3922
|
+
namespace?: string;
|
|
3923
|
+
created_at?: string;
|
|
3924
|
+
modified_at?: string;
|
|
3893
3925
|
[key: string]: unknown;
|
|
3894
|
-
}
|
|
3926
|
+
};
|
|
3927
|
+
type AiSearchListResponse = {
|
|
3928
|
+
result: AiSearchInstanceInfo[];
|
|
3929
|
+
result_info?: {
|
|
3930
|
+
count: number;
|
|
3931
|
+
page: number;
|
|
3932
|
+
per_page: number;
|
|
3933
|
+
total_count: number;
|
|
3934
|
+
};
|
|
3935
|
+
};
|
|
3936
|
+
// ============ AI Search Config Types ============
|
|
3895
3937
|
type AiSearchConfig = {
|
|
3896
3938
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
3897
3939
|
id: string;
|
|
3898
|
-
type
|
|
3899
|
-
|
|
3900
|
-
|
|
3940
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
3941
|
+
type?: "r2" | "web-crawler" | string;
|
|
3942
|
+
/** Source URL (required for web-crawler type). */
|
|
3943
|
+
source?: string;
|
|
3944
|
+
source_params?: unknown;
|
|
3901
3945
|
/** Token ID (UUID format) */
|
|
3902
3946
|
token_id?: string;
|
|
3903
3947
|
ai_gateway_id?: string;
|
|
@@ -3907,54 +3951,307 @@ type AiSearchConfig = {
|
|
|
3907
3951
|
reranking?: boolean;
|
|
3908
3952
|
embedding_model?: string;
|
|
3909
3953
|
ai_search_model?: string;
|
|
3954
|
+
[key: string]: unknown;
|
|
3910
3955
|
};
|
|
3911
|
-
|
|
3956
|
+
// ============ AI Search Item Types ============
|
|
3957
|
+
type AiSearchItemInfo = {
|
|
3912
3958
|
id: string;
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3959
|
+
key: string;
|
|
3960
|
+
status:
|
|
3961
|
+
| "completed"
|
|
3962
|
+
| "error"
|
|
3963
|
+
| "skipped"
|
|
3964
|
+
| "queued"
|
|
3965
|
+
| "processing"
|
|
3966
|
+
| "outdated";
|
|
3967
|
+
metadata?: Record<string, unknown>;
|
|
3916
3968
|
[key: string]: unknown;
|
|
3917
3969
|
};
|
|
3918
|
-
|
|
3919
|
-
|
|
3970
|
+
type AiSearchItemContentResult = {
|
|
3971
|
+
body: ReadableStream;
|
|
3972
|
+
contentType: string;
|
|
3973
|
+
filename: string;
|
|
3974
|
+
size: number;
|
|
3975
|
+
};
|
|
3976
|
+
type AiSearchUploadItemOptions = {
|
|
3977
|
+
metadata?: Record<string, unknown>;
|
|
3978
|
+
};
|
|
3979
|
+
type AiSearchListItemsParams = {
|
|
3980
|
+
page?: number;
|
|
3981
|
+
per_page?: number;
|
|
3982
|
+
};
|
|
3983
|
+
type AiSearchListItemsResponse = {
|
|
3984
|
+
result: AiSearchItemInfo[];
|
|
3985
|
+
result_info?: {
|
|
3986
|
+
count: number;
|
|
3987
|
+
page: number;
|
|
3988
|
+
per_page: number;
|
|
3989
|
+
total_count: number;
|
|
3990
|
+
};
|
|
3991
|
+
};
|
|
3992
|
+
// ============ AI Search Job Types ============
|
|
3993
|
+
type AiSearchJobInfo = {
|
|
3994
|
+
id: string;
|
|
3995
|
+
source: "user" | "schedule";
|
|
3996
|
+
description?: string;
|
|
3997
|
+
last_seen_at?: string;
|
|
3998
|
+
started_at?: string;
|
|
3999
|
+
ended_at?: string;
|
|
4000
|
+
end_reason?: string;
|
|
4001
|
+
};
|
|
4002
|
+
type AiSearchJobLog = {
|
|
4003
|
+
id: number;
|
|
4004
|
+
message: string;
|
|
4005
|
+
message_type: number;
|
|
4006
|
+
created_at: number;
|
|
4007
|
+
};
|
|
4008
|
+
type AiSearchCreateJobParams = {
|
|
4009
|
+
description?: string;
|
|
4010
|
+
};
|
|
4011
|
+
type AiSearchListJobsParams = {
|
|
4012
|
+
page?: number;
|
|
4013
|
+
per_page?: number;
|
|
4014
|
+
};
|
|
4015
|
+
type AiSearchListJobsResponse = {
|
|
4016
|
+
result: AiSearchJobInfo[];
|
|
4017
|
+
result_info?: {
|
|
4018
|
+
count: number;
|
|
4019
|
+
page: number;
|
|
4020
|
+
per_page: number;
|
|
4021
|
+
total_count: number;
|
|
4022
|
+
};
|
|
4023
|
+
};
|
|
4024
|
+
type AiSearchJobLogsParams = {
|
|
4025
|
+
page?: number;
|
|
4026
|
+
per_page?: number;
|
|
4027
|
+
};
|
|
4028
|
+
type AiSearchJobLogsResponse = {
|
|
4029
|
+
result: AiSearchJobLog[];
|
|
4030
|
+
result_info?: {
|
|
4031
|
+
count: number;
|
|
4032
|
+
page: number;
|
|
4033
|
+
per_page: number;
|
|
4034
|
+
total_count: number;
|
|
4035
|
+
};
|
|
4036
|
+
};
|
|
4037
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4038
|
+
/**
|
|
4039
|
+
* Single item service for an AI Search instance.
|
|
4040
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4041
|
+
*/
|
|
4042
|
+
declare abstract class AiSearchItem {
|
|
4043
|
+
/** Get metadata about this item. */
|
|
4044
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4045
|
+
/**
|
|
4046
|
+
* Download the item's content.
|
|
4047
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4048
|
+
*/
|
|
4049
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4050
|
+
}
|
|
4051
|
+
/**
|
|
4052
|
+
* Items collection service for an AI Search instance.
|
|
4053
|
+
* Provides list, upload, and access to individual items.
|
|
4054
|
+
*/
|
|
4055
|
+
declare abstract class AiSearchItems {
|
|
4056
|
+
/** List items in this instance. */
|
|
4057
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4058
|
+
/**
|
|
4059
|
+
* Upload a file as an item.
|
|
4060
|
+
* @param name Filename for the uploaded item.
|
|
4061
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4062
|
+
* @param options Optional metadata to attach to the item.
|
|
4063
|
+
* @returns The created item info.
|
|
4064
|
+
*/
|
|
4065
|
+
upload(
|
|
4066
|
+
name: string,
|
|
4067
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4068
|
+
options?: AiSearchUploadItemOptions,
|
|
4069
|
+
): Promise<AiSearchItemInfo>;
|
|
4070
|
+
/**
|
|
4071
|
+
* Upload a file and poll until processing completes.
|
|
4072
|
+
* @param name Filename for the uploaded item.
|
|
4073
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4074
|
+
* @param options Optional metadata to attach to the item.
|
|
4075
|
+
* @returns The item info after processing completes (or timeout).
|
|
4076
|
+
*/
|
|
4077
|
+
uploadAndPoll(
|
|
4078
|
+
name: string,
|
|
4079
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4080
|
+
options?: AiSearchUploadItemOptions,
|
|
4081
|
+
): Promise<AiSearchItemInfo>;
|
|
4082
|
+
/**
|
|
4083
|
+
* Get an item by ID.
|
|
4084
|
+
* @param itemId The item identifier.
|
|
4085
|
+
* @returns Item service for info, delete, and download operations.
|
|
4086
|
+
*/
|
|
4087
|
+
get(itemId: string): AiSearchItem;
|
|
4088
|
+
/** Delete this item from the instance.
|
|
4089
|
+
* @param itemId The item identifier.
|
|
4090
|
+
*/
|
|
4091
|
+
delete(itemId: string): Promise<void>;
|
|
4092
|
+
}
|
|
4093
|
+
/**
|
|
4094
|
+
* Single job service for an AI Search instance.
|
|
4095
|
+
* Provides info and logs for a specific job.
|
|
4096
|
+
*/
|
|
4097
|
+
declare abstract class AiSearchJob {
|
|
4098
|
+
/** Get metadata about this job. */
|
|
4099
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4100
|
+
/** Get logs for this job. */
|
|
4101
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4102
|
+
}
|
|
4103
|
+
/**
|
|
4104
|
+
* Jobs collection service for an AI Search instance.
|
|
4105
|
+
* Provides list, create, and access to individual jobs.
|
|
4106
|
+
*/
|
|
4107
|
+
declare abstract class AiSearchJobs {
|
|
4108
|
+
/** List jobs for this instance. */
|
|
4109
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4110
|
+
/**
|
|
4111
|
+
* Create a new indexing job.
|
|
4112
|
+
* @param params Optional job parameters.
|
|
4113
|
+
* @returns The created job info.
|
|
4114
|
+
*/
|
|
4115
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4116
|
+
/**
|
|
4117
|
+
* Get a job by ID.
|
|
4118
|
+
* @param jobId The job identifier.
|
|
4119
|
+
* @returns Job service for info and logs operations.
|
|
4120
|
+
*/
|
|
4121
|
+
get(jobId: string): AiSearchJob;
|
|
4122
|
+
}
|
|
4123
|
+
// ============ AI Search Binding Classes ============
|
|
4124
|
+
/**
|
|
4125
|
+
* Instance-level AI Search service.
|
|
4126
|
+
*
|
|
4127
|
+
* Used as:
|
|
4128
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
4129
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
4130
|
+
*
|
|
4131
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
4132
|
+
*
|
|
4133
|
+
* @example
|
|
4134
|
+
* ```ts
|
|
4135
|
+
* // Via namespace binding
|
|
4136
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
4137
|
+
* const results = await instance.search({
|
|
4138
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4139
|
+
* });
|
|
4140
|
+
*
|
|
4141
|
+
* // Via single instance binding
|
|
4142
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
4143
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4144
|
+
* });
|
|
4145
|
+
* ```
|
|
4146
|
+
*/
|
|
4147
|
+
declare abstract class AiSearchInstance {
|
|
3920
4148
|
/**
|
|
3921
4149
|
* Search the AI Search instance for relevant chunks.
|
|
3922
|
-
* @param params Search request with messages and AI search options
|
|
3923
|
-
* @returns Search response with matching chunks
|
|
4150
|
+
* @param params Search request with messages and optional AI search options.
|
|
4151
|
+
* @returns Search response with matching chunks and search query.
|
|
3924
4152
|
*/
|
|
3925
4153
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
4154
|
+
/**
|
|
4155
|
+
* Generate chat completions with AI Search context (streaming).
|
|
4156
|
+
* @param params Chat completions request with stream: true.
|
|
4157
|
+
* @returns ReadableStream of server-sent events.
|
|
4158
|
+
*/
|
|
4159
|
+
chatCompletions(
|
|
4160
|
+
params: AiSearchChatCompletionsRequest & {
|
|
4161
|
+
stream: true;
|
|
4162
|
+
},
|
|
4163
|
+
): Promise<ReadableStream>;
|
|
3926
4164
|
/**
|
|
3927
4165
|
* Generate chat completions with AI Search context.
|
|
3928
|
-
* @param params Chat completions request
|
|
3929
|
-
* @returns
|
|
4166
|
+
* @param params Chat completions request.
|
|
4167
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
3930
4168
|
*/
|
|
3931
4169
|
chatCompletions(
|
|
3932
4170
|
params: AiSearchChatCompletionsRequest,
|
|
3933
|
-
): Promise<
|
|
4171
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
3934
4172
|
/**
|
|
3935
|
-
*
|
|
4173
|
+
* Update the instance configuration.
|
|
4174
|
+
* @param config Partial configuration to update.
|
|
4175
|
+
* @returns Updated instance info.
|
|
3936
4176
|
*/
|
|
3937
|
-
|
|
4177
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
4178
|
+
/** Get metadata about this instance. */
|
|
4179
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
4180
|
+
/**
|
|
4181
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
4182
|
+
* @returns Statistics with counts per status and last activity time.
|
|
4183
|
+
*/
|
|
4184
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
4185
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
4186
|
+
get items(): AiSearchItems;
|
|
4187
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
4188
|
+
get jobs(): AiSearchJobs;
|
|
3938
4189
|
}
|
|
3939
|
-
|
|
3940
|
-
|
|
4190
|
+
/**
|
|
4191
|
+
* Namespace-level AI Search service.
|
|
4192
|
+
*
|
|
4193
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
4194
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
4195
|
+
*
|
|
4196
|
+
* @example
|
|
4197
|
+
* ```ts
|
|
4198
|
+
* // Access an instance within the namespace
|
|
4199
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
4200
|
+
* const results = await blog.search({
|
|
4201
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
4202
|
+
* });
|
|
4203
|
+
*
|
|
4204
|
+
* // List all instances in the namespace
|
|
4205
|
+
* const instances = await env.AI_SEARCH.list();
|
|
4206
|
+
*
|
|
4207
|
+
* // Create a new instance with built-in storage
|
|
4208
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
4209
|
+
* id: "tenant-123",
|
|
4210
|
+
* });
|
|
4211
|
+
*
|
|
4212
|
+
* // Upload items into the instance
|
|
4213
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
4214
|
+
*
|
|
4215
|
+
* // Delete an instance
|
|
4216
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
4217
|
+
* ```
|
|
4218
|
+
*/
|
|
4219
|
+
declare abstract class AiSearchNamespace {
|
|
3941
4220
|
/**
|
|
3942
|
-
*
|
|
3943
|
-
* @
|
|
4221
|
+
* Get an instance by name within the bound namespace.
|
|
4222
|
+
* @param name Instance name.
|
|
4223
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
4224
|
+
*/
|
|
4225
|
+
get(name: string): AiSearchInstance;
|
|
4226
|
+
/**
|
|
4227
|
+
* List all instances in the bound namespace.
|
|
4228
|
+
* @returns Array of instance metadata.
|
|
3944
4229
|
*/
|
|
3945
4230
|
list(): Promise<AiSearchListResponse>;
|
|
3946
4231
|
/**
|
|
3947
|
-
*
|
|
3948
|
-
* @param
|
|
3949
|
-
* @returns Instance service for
|
|
4232
|
+
* Create a new instance within the bound namespace.
|
|
4233
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
4234
|
+
* @returns Instance service for the newly created instance.
|
|
4235
|
+
*
|
|
4236
|
+
* @example
|
|
4237
|
+
* ```ts
|
|
4238
|
+
* // Create with built-in storage (upload items manually)
|
|
4239
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
4240
|
+
*
|
|
4241
|
+
* // Create with web crawler source
|
|
4242
|
+
* const instance = await env.AI_SEARCH.create({
|
|
4243
|
+
* id: "docs-search",
|
|
4244
|
+
* type: "web-crawler",
|
|
4245
|
+
* source: "https://developers.cloudflare.com",
|
|
4246
|
+
* });
|
|
4247
|
+
* ```
|
|
3950
4248
|
*/
|
|
3951
|
-
|
|
4249
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
3952
4250
|
/**
|
|
3953
|
-
*
|
|
3954
|
-
* @param
|
|
3955
|
-
* @returns Instance service for performing operations
|
|
4251
|
+
* Delete an instance from the bound namespace.
|
|
4252
|
+
* @param name Instance name to delete.
|
|
3956
4253
|
*/
|
|
3957
|
-
|
|
4254
|
+
delete(name: string): Promise<void>;
|
|
3958
4255
|
}
|
|
3959
4256
|
type AiImageClassificationInput = {
|
|
3960
4257
|
image: number[];
|
|
@@ -9952,6 +10249,7 @@ type AiOptions = {
|
|
|
9952
10249
|
returnRawResponse?: boolean;
|
|
9953
10250
|
prefix?: string;
|
|
9954
10251
|
extraHeaders?: object;
|
|
10252
|
+
signal?: AbortSignal;
|
|
9955
10253
|
};
|
|
9956
10254
|
type AiModelsSearchParams = {
|
|
9957
10255
|
author?: string;
|
|
@@ -9995,46 +10293,16 @@ declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
|
9995
10293
|
aiGatewayLogId: string | null;
|
|
9996
10294
|
gateway(gatewayId: string): AiGateway;
|
|
9997
10295
|
/**
|
|
9998
|
-
*
|
|
9999
|
-
*
|
|
10000
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10001
|
-
* - Account-level operations: `list()`, `create()`
|
|
10002
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10003
|
-
*
|
|
10004
|
-
* @example
|
|
10005
|
-
* ```typescript
|
|
10006
|
-
* // List all AI Search instances
|
|
10007
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10008
|
-
*
|
|
10009
|
-
* // Search an instance
|
|
10010
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10011
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10012
|
-
* ai_search_options: {
|
|
10013
|
-
* retrieval: { max_num_results: 10 }
|
|
10014
|
-
* }
|
|
10015
|
-
* });
|
|
10016
|
-
*
|
|
10017
|
-
* // Generate chat completions with AI Search context
|
|
10018
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10019
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10020
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10021
|
-
* });
|
|
10022
|
-
* ```
|
|
10296
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10297
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10023
10298
|
*/
|
|
10024
|
-
aiSearch():
|
|
10299
|
+
aiSearch(): AiSearchNamespace;
|
|
10025
10300
|
/**
|
|
10026
10301
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10027
|
-
* Use `
|
|
10028
|
-
*
|
|
10029
|
-
* Migration guide:
|
|
10030
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10031
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10032
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10302
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
10303
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10033
10304
|
*
|
|
10034
|
-
*
|
|
10035
|
-
*
|
|
10036
|
-
* @see AiSearchAccountService
|
|
10037
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
10305
|
+
* @param autoragId Instance ID
|
|
10038
10306
|
*/
|
|
10039
10307
|
autorag(autoragId: string): AutoRAG;
|
|
10040
10308
|
run<
|
|
@@ -10193,22 +10461,23 @@ declare abstract class AiGateway {
|
|
|
10193
10461
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
10194
10462
|
}
|
|
10195
10463
|
/**
|
|
10196
|
-
* @deprecated
|
|
10197
|
-
*
|
|
10464
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10465
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10198
10466
|
*/
|
|
10199
10467
|
interface AutoRAGInternalError extends Error {}
|
|
10200
10468
|
/**
|
|
10201
|
-
* @deprecated
|
|
10202
|
-
*
|
|
10469
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10470
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10203
10471
|
*/
|
|
10204
10472
|
interface AutoRAGNotFoundError extends Error {}
|
|
10205
10473
|
/**
|
|
10206
|
-
* @deprecated
|
|
10474
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10475
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10207
10476
|
*/
|
|
10208
10477
|
interface AutoRAGUnauthorizedError extends Error {}
|
|
10209
10478
|
/**
|
|
10210
|
-
* @deprecated
|
|
10211
|
-
*
|
|
10479
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10480
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10212
10481
|
*/
|
|
10213
10482
|
interface AutoRAGNameNotSetError extends Error {}
|
|
10214
10483
|
type ComparisonFilter = {
|
|
@@ -10221,9 +10490,8 @@ type CompoundFilter = {
|
|
|
10221
10490
|
filters: ComparisonFilter[];
|
|
10222
10491
|
};
|
|
10223
10492
|
/**
|
|
10224
|
-
* @deprecated
|
|
10225
|
-
*
|
|
10226
|
-
* @see AiSearchSearchRequest
|
|
10493
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10494
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10227
10495
|
*/
|
|
10228
10496
|
type AutoRagSearchRequest = {
|
|
10229
10497
|
query: string;
|
|
@@ -10240,18 +10508,16 @@ type AutoRagSearchRequest = {
|
|
|
10240
10508
|
rewrite_query?: boolean;
|
|
10241
10509
|
};
|
|
10242
10510
|
/**
|
|
10243
|
-
* @deprecated
|
|
10244
|
-
*
|
|
10245
|
-
* @see AiSearchChatCompletionsRequest
|
|
10511
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10512
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10246
10513
|
*/
|
|
10247
10514
|
type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
10248
10515
|
stream?: boolean;
|
|
10249
10516
|
system_prompt?: string;
|
|
10250
10517
|
};
|
|
10251
10518
|
/**
|
|
10252
|
-
* @deprecated
|
|
10253
|
-
*
|
|
10254
|
-
* @see AiSearchChatCompletionsRequest
|
|
10519
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10520
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10255
10521
|
*/
|
|
10256
10522
|
type AutoRagAiSearchRequestStreaming = Omit<
|
|
10257
10523
|
AutoRagAiSearchRequest,
|
|
@@ -10260,9 +10526,8 @@ type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
10260
10526
|
stream: true;
|
|
10261
10527
|
};
|
|
10262
10528
|
/**
|
|
10263
|
-
* @deprecated
|
|
10264
|
-
*
|
|
10265
|
-
* @see AiSearchSearchResponse
|
|
10529
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10530
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10266
10531
|
*/
|
|
10267
10532
|
type AutoRagSearchResponse = {
|
|
10268
10533
|
object: "vector_store.search_results.page";
|
|
@@ -10281,9 +10546,8 @@ type AutoRagSearchResponse = {
|
|
|
10281
10546
|
next_page: string | null;
|
|
10282
10547
|
};
|
|
10283
10548
|
/**
|
|
10284
|
-
* @deprecated
|
|
10285
|
-
*
|
|
10286
|
-
* @see AiSearchListResponse
|
|
10549
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10550
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10287
10551
|
*/
|
|
10288
10552
|
type AutoRagListResponse = {
|
|
10289
10553
|
id: string;
|
|
@@ -10295,49 +10559,40 @@ type AutoRagListResponse = {
|
|
|
10295
10559
|
status: string;
|
|
10296
10560
|
}[];
|
|
10297
10561
|
/**
|
|
10298
|
-
* @deprecated
|
|
10299
|
-
*
|
|
10562
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10563
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10300
10564
|
*/
|
|
10301
10565
|
type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
10302
10566
|
response: string;
|
|
10303
10567
|
};
|
|
10304
10568
|
/**
|
|
10305
|
-
* @deprecated
|
|
10306
|
-
*
|
|
10307
|
-
*
|
|
10308
|
-
* Migration guide:
|
|
10309
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10310
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
10311
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10312
|
-
*
|
|
10313
|
-
* @see AiSearchAccountService
|
|
10314
|
-
* @see AiSearchInstanceService
|
|
10569
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10570
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10315
10571
|
*/
|
|
10316
10572
|
declare abstract class AutoRAG {
|
|
10317
10573
|
/**
|
|
10318
|
-
* @deprecated Use
|
|
10319
|
-
*
|
|
10574
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10575
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10320
10576
|
*/
|
|
10321
10577
|
list(): Promise<AutoRagListResponse>;
|
|
10322
10578
|
/**
|
|
10323
|
-
* @deprecated Use
|
|
10324
|
-
*
|
|
10325
|
-
* @see AiSearchInstanceService.search
|
|
10579
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10580
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10326
10581
|
*/
|
|
10327
10582
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
10328
10583
|
/**
|
|
10329
|
-
* @deprecated Use
|
|
10330
|
-
*
|
|
10584
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10585
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10331
10586
|
*/
|
|
10332
10587
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
10333
10588
|
/**
|
|
10334
|
-
* @deprecated Use
|
|
10335
|
-
*
|
|
10589
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10590
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10336
10591
|
*/
|
|
10337
10592
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
10338
10593
|
/**
|
|
10339
|
-
* @deprecated Use
|
|
10340
|
-
*
|
|
10594
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
10595
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10341
10596
|
*/
|
|
10342
10597
|
aiSearch(
|
|
10343
10598
|
params: AutoRagAiSearchRequest,
|