@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/experimental/index.ts
CHANGED
|
@@ -3272,6 +3272,11 @@ export interface QueuingStrategyInit {
|
|
|
3272
3272
|
*/
|
|
3273
3273
|
highWaterMark: number;
|
|
3274
3274
|
}
|
|
3275
|
+
export interface TracePreviewInfo {
|
|
3276
|
+
id: string;
|
|
3277
|
+
slug: string;
|
|
3278
|
+
name: string;
|
|
3279
|
+
}
|
|
3275
3280
|
export interface ScriptVersion {
|
|
3276
3281
|
id?: string;
|
|
3277
3282
|
tag?: string;
|
|
@@ -3306,6 +3311,7 @@ export interface TraceItem {
|
|
|
3306
3311
|
readonly dispatchNamespace?: string;
|
|
3307
3312
|
readonly scriptTags?: string[];
|
|
3308
3313
|
readonly tailAttributes?: Record<string, boolean | number | string>;
|
|
3314
|
+
readonly preview?: TracePreviewInfo;
|
|
3309
3315
|
readonly durableObjectId?: string;
|
|
3310
3316
|
readonly outcome: string;
|
|
3311
3317
|
readonly executionModel: string;
|
|
@@ -3947,6 +3953,9 @@ export interface Container {
|
|
|
3947
3953
|
snapshotDirectory(
|
|
3948
3954
|
options: ContainerDirectorySnapshotOptions,
|
|
3949
3955
|
): Promise<ContainerDirectorySnapshot>;
|
|
3956
|
+
snapshotContainer(
|
|
3957
|
+
options: ContainerSnapshotOptions,
|
|
3958
|
+
): Promise<ContainerSnapshot>;
|
|
3950
3959
|
}
|
|
3951
3960
|
export interface ContainerDirectorySnapshot {
|
|
3952
3961
|
id: string;
|
|
@@ -3958,17 +3967,26 @@ export interface ContainerDirectorySnapshotOptions {
|
|
|
3958
3967
|
dir: string;
|
|
3959
3968
|
name?: string;
|
|
3960
3969
|
}
|
|
3961
|
-
export interface
|
|
3970
|
+
export interface ContainerDirectorySnapshotRestoreParams {
|
|
3962
3971
|
snapshot: ContainerDirectorySnapshot;
|
|
3963
3972
|
mountPoint?: string;
|
|
3964
3973
|
}
|
|
3974
|
+
export interface ContainerSnapshot {
|
|
3975
|
+
id: string;
|
|
3976
|
+
size: number;
|
|
3977
|
+
name?: string;
|
|
3978
|
+
}
|
|
3979
|
+
export interface ContainerSnapshotOptions {
|
|
3980
|
+
name?: string;
|
|
3981
|
+
}
|
|
3965
3982
|
export interface ContainerStartupOptions {
|
|
3966
3983
|
entrypoint?: string[];
|
|
3967
3984
|
enableInternet: boolean;
|
|
3968
3985
|
env?: Record<string, string>;
|
|
3969
3986
|
hardTimeout?: number | bigint;
|
|
3970
3987
|
labels?: Record<string, string>;
|
|
3971
|
-
|
|
3988
|
+
directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
|
|
3989
|
+
containerSnapshot?: ContainerSnapshot;
|
|
3972
3990
|
}
|
|
3973
3991
|
/**
|
|
3974
3992
|
* The **`FileSystemHandle`** interface of the File System API is an object which represents a file or directory entry.
|
|
@@ -4647,11 +4665,10 @@ export interface EventCounts {
|
|
|
4647
4665
|
): void;
|
|
4648
4666
|
[Symbol.iterator](): IterableIterator<string[]>;
|
|
4649
4667
|
}
|
|
4650
|
-
// AI Search
|
|
4668
|
+
// ============ AI Search Error Interfaces ============
|
|
4651
4669
|
export interface AiSearchInternalError extends Error {}
|
|
4652
4670
|
export interface AiSearchNotFoundError extends Error {}
|
|
4653
|
-
|
|
4654
|
-
// AI Search V2 Request Types
|
|
4671
|
+
// ============ AI Search Request Types ============
|
|
4655
4672
|
export type AiSearchSearchRequest = {
|
|
4656
4673
|
messages: Array<{
|
|
4657
4674
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
@@ -4676,9 +4693,8 @@ export type AiSearchSearchRequest = {
|
|
|
4676
4693
|
[key: string]: unknown;
|
|
4677
4694
|
};
|
|
4678
4695
|
reranking?: {
|
|
4679
|
-
/** Enable reranking (default false) */
|
|
4680
4696
|
enabled?: boolean;
|
|
4681
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4697
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
4682
4698
|
/** Match threshold (0-1, default 0.4) */
|
|
4683
4699
|
match_threshold?: number;
|
|
4684
4700
|
[key: string]: unknown;
|
|
@@ -4690,6 +4706,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
4690
4706
|
messages: Array<{
|
|
4691
4707
|
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4692
4708
|
content: string | null;
|
|
4709
|
+
[key: string]: unknown;
|
|
4693
4710
|
}>;
|
|
4694
4711
|
model?: string;
|
|
4695
4712
|
stream?: boolean;
|
|
@@ -4710,7 +4727,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
4710
4727
|
};
|
|
4711
4728
|
reranking?: {
|
|
4712
4729
|
enabled?: boolean;
|
|
4713
|
-
model?: "@cf/baai/bge-reranker-base" |
|
|
4730
|
+
model?: "@cf/baai/bge-reranker-base" | string;
|
|
4714
4731
|
match_threshold?: number;
|
|
4715
4732
|
[key: string]: unknown;
|
|
4716
4733
|
};
|
|
@@ -4718,7 +4735,7 @@ export type AiSearchChatCompletionsRequest = {
|
|
|
4718
4735
|
};
|
|
4719
4736
|
[key: string]: unknown;
|
|
4720
4737
|
};
|
|
4721
|
-
// AI Search
|
|
4738
|
+
// ============ AI Search Response Types ============
|
|
4722
4739
|
export type AiSearchSearchResponse = {
|
|
4723
4740
|
search_query: string;
|
|
4724
4741
|
chunks: Array<{
|
|
@@ -4737,26 +4754,65 @@ export type AiSearchSearchResponse = {
|
|
|
4737
4754
|
keyword_score?: number;
|
|
4738
4755
|
/** Vector similarity score (0-1) */
|
|
4739
4756
|
vector_score?: number;
|
|
4757
|
+
[key: string]: unknown;
|
|
4740
4758
|
};
|
|
4741
4759
|
}>;
|
|
4742
4760
|
};
|
|
4743
|
-
export type
|
|
4761
|
+
export type AiSearchChatCompletionsResponse = {
|
|
4762
|
+
id?: string;
|
|
4763
|
+
object?: string;
|
|
4764
|
+
model?: string;
|
|
4765
|
+
choices: Array<{
|
|
4766
|
+
index?: number;
|
|
4767
|
+
message: {
|
|
4768
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
4769
|
+
content: string | null;
|
|
4770
|
+
[key: string]: unknown;
|
|
4771
|
+
};
|
|
4772
|
+
[key: string]: unknown;
|
|
4773
|
+
}>;
|
|
4774
|
+
chunks: AiSearchSearchResponse["chunks"];
|
|
4775
|
+
[key: string]: unknown;
|
|
4776
|
+
};
|
|
4777
|
+
export type AiSearchStatsResponse = {
|
|
4778
|
+
queued?: number;
|
|
4779
|
+
running?: number;
|
|
4780
|
+
completed?: number;
|
|
4781
|
+
error?: number;
|
|
4782
|
+
skipped?: number;
|
|
4783
|
+
outdated?: number;
|
|
4784
|
+
last_activity?: string;
|
|
4785
|
+
};
|
|
4786
|
+
// ============ AI Search Instance Info Types ============
|
|
4787
|
+
export type AiSearchInstanceInfo = {
|
|
4744
4788
|
id: string;
|
|
4745
|
-
|
|
4746
|
-
account_id?: string;
|
|
4747
|
-
account_tag?: string;
|
|
4748
|
-
/** Whether the instance is enabled (default true) */
|
|
4749
|
-
enable?: boolean;
|
|
4750
|
-
type?: "r2" | "web-crawler";
|
|
4789
|
+
type?: "r2" | "web-crawler" | string;
|
|
4751
4790
|
source?: string;
|
|
4791
|
+
paused?: boolean;
|
|
4792
|
+
status?: string;
|
|
4793
|
+
namespace?: string;
|
|
4794
|
+
created_at?: string;
|
|
4795
|
+
modified_at?: string;
|
|
4752
4796
|
[key: string]: unknown;
|
|
4753
|
-
}
|
|
4797
|
+
};
|
|
4798
|
+
export type AiSearchListResponse = {
|
|
4799
|
+
result: AiSearchInstanceInfo[];
|
|
4800
|
+
result_info?: {
|
|
4801
|
+
count: number;
|
|
4802
|
+
page: number;
|
|
4803
|
+
per_page: number;
|
|
4804
|
+
total_count: number;
|
|
4805
|
+
};
|
|
4806
|
+
};
|
|
4807
|
+
// ============ AI Search Config Types ============
|
|
4754
4808
|
export type AiSearchConfig = {
|
|
4755
4809
|
/** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */
|
|
4756
4810
|
id: string;
|
|
4757
|
-
type
|
|
4758
|
-
|
|
4759
|
-
|
|
4811
|
+
/** Instance type. Omit to create with built-in storage. */
|
|
4812
|
+
type?: "r2" | "web-crawler" | string;
|
|
4813
|
+
/** Source URL (required for web-crawler type). */
|
|
4814
|
+
source?: string;
|
|
4815
|
+
source_params?: unknown;
|
|
4760
4816
|
/** Token ID (UUID format) */
|
|
4761
4817
|
token_id?: string;
|
|
4762
4818
|
ai_gateway_id?: string;
|
|
@@ -4766,54 +4822,307 @@ export type AiSearchConfig = {
|
|
|
4766
4822
|
reranking?: boolean;
|
|
4767
4823
|
embedding_model?: string;
|
|
4768
4824
|
ai_search_model?: string;
|
|
4825
|
+
[key: string]: unknown;
|
|
4769
4826
|
};
|
|
4770
|
-
|
|
4827
|
+
// ============ AI Search Item Types ============
|
|
4828
|
+
export type AiSearchItemInfo = {
|
|
4771
4829
|
id: string;
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4830
|
+
key: string;
|
|
4831
|
+
status:
|
|
4832
|
+
| "completed"
|
|
4833
|
+
| "error"
|
|
4834
|
+
| "skipped"
|
|
4835
|
+
| "queued"
|
|
4836
|
+
| "processing"
|
|
4837
|
+
| "outdated";
|
|
4838
|
+
metadata?: Record<string, unknown>;
|
|
4775
4839
|
[key: string]: unknown;
|
|
4776
4840
|
};
|
|
4777
|
-
|
|
4778
|
-
|
|
4841
|
+
export type AiSearchItemContentResult = {
|
|
4842
|
+
body: ReadableStream;
|
|
4843
|
+
contentType: string;
|
|
4844
|
+
filename: string;
|
|
4845
|
+
size: number;
|
|
4846
|
+
};
|
|
4847
|
+
export type AiSearchUploadItemOptions = {
|
|
4848
|
+
metadata?: Record<string, unknown>;
|
|
4849
|
+
};
|
|
4850
|
+
export type AiSearchListItemsParams = {
|
|
4851
|
+
page?: number;
|
|
4852
|
+
per_page?: number;
|
|
4853
|
+
};
|
|
4854
|
+
export type AiSearchListItemsResponse = {
|
|
4855
|
+
result: AiSearchItemInfo[];
|
|
4856
|
+
result_info?: {
|
|
4857
|
+
count: number;
|
|
4858
|
+
page: number;
|
|
4859
|
+
per_page: number;
|
|
4860
|
+
total_count: number;
|
|
4861
|
+
};
|
|
4862
|
+
};
|
|
4863
|
+
// ============ AI Search Job Types ============
|
|
4864
|
+
export type AiSearchJobInfo = {
|
|
4865
|
+
id: string;
|
|
4866
|
+
source: "user" | "schedule";
|
|
4867
|
+
description?: string;
|
|
4868
|
+
last_seen_at?: string;
|
|
4869
|
+
started_at?: string;
|
|
4870
|
+
ended_at?: string;
|
|
4871
|
+
end_reason?: string;
|
|
4872
|
+
};
|
|
4873
|
+
export type AiSearchJobLog = {
|
|
4874
|
+
id: number;
|
|
4875
|
+
message: string;
|
|
4876
|
+
message_type: number;
|
|
4877
|
+
created_at: number;
|
|
4878
|
+
};
|
|
4879
|
+
export type AiSearchCreateJobParams = {
|
|
4880
|
+
description?: string;
|
|
4881
|
+
};
|
|
4882
|
+
export type AiSearchListJobsParams = {
|
|
4883
|
+
page?: number;
|
|
4884
|
+
per_page?: number;
|
|
4885
|
+
};
|
|
4886
|
+
export type AiSearchListJobsResponse = {
|
|
4887
|
+
result: AiSearchJobInfo[];
|
|
4888
|
+
result_info?: {
|
|
4889
|
+
count: number;
|
|
4890
|
+
page: number;
|
|
4891
|
+
per_page: number;
|
|
4892
|
+
total_count: number;
|
|
4893
|
+
};
|
|
4894
|
+
};
|
|
4895
|
+
export type AiSearchJobLogsParams = {
|
|
4896
|
+
page?: number;
|
|
4897
|
+
per_page?: number;
|
|
4898
|
+
};
|
|
4899
|
+
export type AiSearchJobLogsResponse = {
|
|
4900
|
+
result: AiSearchJobLog[];
|
|
4901
|
+
result_info?: {
|
|
4902
|
+
count: number;
|
|
4903
|
+
page: number;
|
|
4904
|
+
per_page: number;
|
|
4905
|
+
total_count: number;
|
|
4906
|
+
};
|
|
4907
|
+
};
|
|
4908
|
+
// ============ AI Search Sub-Service Classes ============
|
|
4909
|
+
/**
|
|
4910
|
+
* Single item service for an AI Search instance.
|
|
4911
|
+
* Provides info, delete, and download operations on a specific item.
|
|
4912
|
+
*/
|
|
4913
|
+
export declare abstract class AiSearchItem {
|
|
4914
|
+
/** Get metadata about this item. */
|
|
4915
|
+
info(): Promise<AiSearchItemInfo>;
|
|
4916
|
+
/**
|
|
4917
|
+
* Download the item's content.
|
|
4918
|
+
* @returns Object with body stream, content type, filename, and size.
|
|
4919
|
+
*/
|
|
4920
|
+
download(): Promise<AiSearchItemContentResult>;
|
|
4921
|
+
}
|
|
4922
|
+
/**
|
|
4923
|
+
* Items collection service for an AI Search instance.
|
|
4924
|
+
* Provides list, upload, and access to individual items.
|
|
4925
|
+
*/
|
|
4926
|
+
export declare abstract class AiSearchItems {
|
|
4927
|
+
/** List items in this instance. */
|
|
4928
|
+
list(params?: AiSearchListItemsParams): Promise<AiSearchListItemsResponse>;
|
|
4929
|
+
/**
|
|
4930
|
+
* Upload a file as an item.
|
|
4931
|
+
* @param name Filename for the uploaded item.
|
|
4932
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4933
|
+
* @param options Optional metadata to attach to the item.
|
|
4934
|
+
* @returns The created item info.
|
|
4935
|
+
*/
|
|
4936
|
+
upload(
|
|
4937
|
+
name: string,
|
|
4938
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4939
|
+
options?: AiSearchUploadItemOptions,
|
|
4940
|
+
): Promise<AiSearchItemInfo>;
|
|
4941
|
+
/**
|
|
4942
|
+
* Upload a file and poll until processing completes.
|
|
4943
|
+
* @param name Filename for the uploaded item.
|
|
4944
|
+
* @param content File content as a ReadableStream, ArrayBuffer, or string.
|
|
4945
|
+
* @param options Optional metadata to attach to the item.
|
|
4946
|
+
* @returns The item info after processing completes (or timeout).
|
|
4947
|
+
*/
|
|
4948
|
+
uploadAndPoll(
|
|
4949
|
+
name: string,
|
|
4950
|
+
content: ReadableStream | ArrayBuffer | string,
|
|
4951
|
+
options?: AiSearchUploadItemOptions,
|
|
4952
|
+
): Promise<AiSearchItemInfo>;
|
|
4953
|
+
/**
|
|
4954
|
+
* Get an item by ID.
|
|
4955
|
+
* @param itemId The item identifier.
|
|
4956
|
+
* @returns Item service for info, delete, and download operations.
|
|
4957
|
+
*/
|
|
4958
|
+
get(itemId: string): AiSearchItem;
|
|
4959
|
+
/** Delete this item from the instance.
|
|
4960
|
+
* @param itemId The item identifier.
|
|
4961
|
+
*/
|
|
4962
|
+
delete(itemId: string): Promise<void>;
|
|
4963
|
+
}
|
|
4964
|
+
/**
|
|
4965
|
+
* Single job service for an AI Search instance.
|
|
4966
|
+
* Provides info and logs for a specific job.
|
|
4967
|
+
*/
|
|
4968
|
+
export declare abstract class AiSearchJob {
|
|
4969
|
+
/** Get metadata about this job. */
|
|
4970
|
+
info(): Promise<AiSearchJobInfo>;
|
|
4971
|
+
/** Get logs for this job. */
|
|
4972
|
+
logs(params?: AiSearchJobLogsParams): Promise<AiSearchJobLogsResponse>;
|
|
4973
|
+
}
|
|
4974
|
+
/**
|
|
4975
|
+
* Jobs collection service for an AI Search instance.
|
|
4976
|
+
* Provides list, create, and access to individual jobs.
|
|
4977
|
+
*/
|
|
4978
|
+
export declare abstract class AiSearchJobs {
|
|
4979
|
+
/** List jobs for this instance. */
|
|
4980
|
+
list(params?: AiSearchListJobsParams): Promise<AiSearchListJobsResponse>;
|
|
4981
|
+
/**
|
|
4982
|
+
* Create a new indexing job.
|
|
4983
|
+
* @param params Optional job parameters.
|
|
4984
|
+
* @returns The created job info.
|
|
4985
|
+
*/
|
|
4986
|
+
create(params?: AiSearchCreateJobParams): Promise<AiSearchJobInfo>;
|
|
4987
|
+
/**
|
|
4988
|
+
* Get a job by ID.
|
|
4989
|
+
* @param jobId The job identifier.
|
|
4990
|
+
* @returns Job service for info and logs operations.
|
|
4991
|
+
*/
|
|
4992
|
+
get(jobId: string): AiSearchJob;
|
|
4993
|
+
}
|
|
4994
|
+
// ============ AI Search Binding Classes ============
|
|
4995
|
+
/**
|
|
4996
|
+
* Instance-level AI Search service.
|
|
4997
|
+
*
|
|
4998
|
+
* Used as:
|
|
4999
|
+
* - The return type of `AiSearchNamespace.get(name)` (namespace binding)
|
|
5000
|
+
* - The type of `env.BLOG_SEARCH` (single instance binding via `ai_search`)
|
|
5001
|
+
*
|
|
5002
|
+
* Provides search, chat, update, stats, items, and jobs operations.
|
|
5003
|
+
*
|
|
5004
|
+
* @example
|
|
5005
|
+
* ```ts
|
|
5006
|
+
* // Via namespace binding
|
|
5007
|
+
* const instance = env.AI_SEARCH.get("blog");
|
|
5008
|
+
* const results = await instance.search({
|
|
5009
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5010
|
+
* });
|
|
5011
|
+
*
|
|
5012
|
+
* // Via single instance binding
|
|
5013
|
+
* const results = await env.BLOG_SEARCH.search({
|
|
5014
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5015
|
+
* });
|
|
5016
|
+
* ```
|
|
5017
|
+
*/
|
|
5018
|
+
export declare abstract class AiSearchInstance {
|
|
4779
5019
|
/**
|
|
4780
5020
|
* Search the AI Search instance for relevant chunks.
|
|
4781
|
-
* @param params Search request with messages and AI search options
|
|
4782
|
-
* @returns Search response with matching chunks
|
|
5021
|
+
* @param params Search request with messages and optional AI search options.
|
|
5022
|
+
* @returns Search response with matching chunks and search query.
|
|
4783
5023
|
*/
|
|
4784
5024
|
search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;
|
|
5025
|
+
/**
|
|
5026
|
+
* Generate chat completions with AI Search context (streaming).
|
|
5027
|
+
* @param params Chat completions request with stream: true.
|
|
5028
|
+
* @returns ReadableStream of server-sent events.
|
|
5029
|
+
*/
|
|
5030
|
+
chatCompletions(
|
|
5031
|
+
params: AiSearchChatCompletionsRequest & {
|
|
5032
|
+
stream: true;
|
|
5033
|
+
},
|
|
5034
|
+
): Promise<ReadableStream>;
|
|
4785
5035
|
/**
|
|
4786
5036
|
* Generate chat completions with AI Search context.
|
|
4787
|
-
* @param params Chat completions request
|
|
4788
|
-
* @returns
|
|
5037
|
+
* @param params Chat completions request.
|
|
5038
|
+
* @returns Chat completion response with choices and RAG chunks.
|
|
4789
5039
|
*/
|
|
4790
5040
|
chatCompletions(
|
|
4791
5041
|
params: AiSearchChatCompletionsRequest,
|
|
4792
|
-
): Promise<
|
|
5042
|
+
): Promise<AiSearchChatCompletionsResponse>;
|
|
4793
5043
|
/**
|
|
4794
|
-
*
|
|
5044
|
+
* Update the instance configuration.
|
|
5045
|
+
* @param config Partial configuration to update.
|
|
5046
|
+
* @returns Updated instance info.
|
|
4795
5047
|
*/
|
|
4796
|
-
|
|
5048
|
+
update(config: Partial<AiSearchConfig>): Promise<AiSearchInstanceInfo>;
|
|
5049
|
+
/** Get metadata about this instance. */
|
|
5050
|
+
info(): Promise<AiSearchInstanceInfo>;
|
|
5051
|
+
/**
|
|
5052
|
+
* Get instance statistics (item count, indexing status, etc.).
|
|
5053
|
+
* @returns Statistics with counts per status and last activity time.
|
|
5054
|
+
*/
|
|
5055
|
+
stats(): Promise<AiSearchStatsResponse>;
|
|
5056
|
+
/** Items collection — list, upload, and manage items in this instance. */
|
|
5057
|
+
get items(): AiSearchItems;
|
|
5058
|
+
/** Jobs collection — list, create, and inspect indexing jobs. */
|
|
5059
|
+
get jobs(): AiSearchJobs;
|
|
4797
5060
|
}
|
|
4798
|
-
|
|
4799
|
-
|
|
5061
|
+
/**
|
|
5062
|
+
* Namespace-level AI Search service.
|
|
5063
|
+
*
|
|
5064
|
+
* Used as the type of `env.AI_SEARCH` (namespace binding via `ai_search_namespaces`).
|
|
5065
|
+
* Scoped to a single namespace. Provides dynamic instance access, creation, and deletion.
|
|
5066
|
+
*
|
|
5067
|
+
* @example
|
|
5068
|
+
* ```ts
|
|
5069
|
+
* // Access an instance within the namespace
|
|
5070
|
+
* const blog = env.AI_SEARCH.get("blog");
|
|
5071
|
+
* const results = await blog.search({
|
|
5072
|
+
* messages: [{ role: "user", content: "How does caching work?" }],
|
|
5073
|
+
* });
|
|
5074
|
+
*
|
|
5075
|
+
* // List all instances in the namespace
|
|
5076
|
+
* const instances = await env.AI_SEARCH.list();
|
|
5077
|
+
*
|
|
5078
|
+
* // Create a new instance with built-in storage
|
|
5079
|
+
* const tenant = await env.AI_SEARCH.create({
|
|
5080
|
+
* id: "tenant-123",
|
|
5081
|
+
* });
|
|
5082
|
+
*
|
|
5083
|
+
* // Upload items into the instance
|
|
5084
|
+
* await tenant.items.upload("doc.pdf", fileContent);
|
|
5085
|
+
*
|
|
5086
|
+
* // Delete an instance
|
|
5087
|
+
* await env.AI_SEARCH.delete("tenant-123");
|
|
5088
|
+
* ```
|
|
5089
|
+
*/
|
|
5090
|
+
export declare abstract class AiSearchNamespace {
|
|
5091
|
+
/**
|
|
5092
|
+
* Get an instance by name within the bound namespace.
|
|
5093
|
+
* @param name Instance name.
|
|
5094
|
+
* @returns Instance service for search, chat, update, stats, items, and jobs.
|
|
5095
|
+
*/
|
|
5096
|
+
get(name: string): AiSearchInstance;
|
|
4800
5097
|
/**
|
|
4801
|
-
* List all
|
|
4802
|
-
* @returns Array of
|
|
5098
|
+
* List all instances in the bound namespace.
|
|
5099
|
+
* @returns Array of instance metadata.
|
|
4803
5100
|
*/
|
|
4804
5101
|
list(): Promise<AiSearchListResponse>;
|
|
4805
5102
|
/**
|
|
4806
|
-
*
|
|
4807
|
-
* @param
|
|
4808
|
-
* @returns Instance service for
|
|
5103
|
+
* Create a new instance within the bound namespace.
|
|
5104
|
+
* @param config Instance configuration. Only `id` is required — omit `type` and `source` to create with built-in storage.
|
|
5105
|
+
* @returns Instance service for the newly created instance.
|
|
5106
|
+
*
|
|
5107
|
+
* @example
|
|
5108
|
+
* ```ts
|
|
5109
|
+
* // Create with built-in storage (upload items manually)
|
|
5110
|
+
* const instance = await env.AI_SEARCH.create({ id: "my-search" });
|
|
5111
|
+
*
|
|
5112
|
+
* // Create with web crawler source
|
|
5113
|
+
* const instance = await env.AI_SEARCH.create({
|
|
5114
|
+
* id: "docs-search",
|
|
5115
|
+
* type: "web-crawler",
|
|
5116
|
+
* source: "https://developers.cloudflare.com",
|
|
5117
|
+
* });
|
|
5118
|
+
* ```
|
|
4809
5119
|
*/
|
|
4810
|
-
|
|
5120
|
+
create(config: AiSearchConfig): Promise<AiSearchInstance>;
|
|
4811
5121
|
/**
|
|
4812
|
-
*
|
|
4813
|
-
* @param
|
|
4814
|
-
* @returns Instance service for performing operations
|
|
5122
|
+
* Delete an instance from the bound namespace.
|
|
5123
|
+
* @param name Instance name to delete.
|
|
4815
5124
|
*/
|
|
4816
|
-
|
|
5125
|
+
delete(name: string): Promise<void>;
|
|
4817
5126
|
}
|
|
4818
5127
|
export type AiImageClassificationInput = {
|
|
4819
5128
|
image: number[];
|
|
@@ -10814,6 +11123,7 @@ export type AiOptions = {
|
|
|
10814
11123
|
returnRawResponse?: boolean;
|
|
10815
11124
|
prefix?: string;
|
|
10816
11125
|
extraHeaders?: object;
|
|
11126
|
+
signal?: AbortSignal;
|
|
10817
11127
|
};
|
|
10818
11128
|
export type AiModelsSearchParams = {
|
|
10819
11129
|
author?: string;
|
|
@@ -10859,46 +11169,16 @@ export declare abstract class Ai<
|
|
|
10859
11169
|
aiGatewayLogId: string | null;
|
|
10860
11170
|
gateway(gatewayId: string): AiGateway;
|
|
10861
11171
|
/**
|
|
10862
|
-
*
|
|
10863
|
-
*
|
|
10864
|
-
* This is the new API that replaces AutoRAG with better namespace separation:
|
|
10865
|
-
* - Account-level operations: `list()`, `create()`
|
|
10866
|
-
* - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`
|
|
10867
|
-
*
|
|
10868
|
-
* @example
|
|
10869
|
-
* ```typescript
|
|
10870
|
-
* // List all AI Search instances
|
|
10871
|
-
* const instances = await env.AI.aiSearch.list();
|
|
10872
|
-
*
|
|
10873
|
-
* // Search an instance
|
|
10874
|
-
* const results = await env.AI.aiSearch.get('my-search').search({
|
|
10875
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10876
|
-
* ai_search_options: {
|
|
10877
|
-
* retrieval: { max_num_results: 10 }
|
|
10878
|
-
* }
|
|
10879
|
-
* });
|
|
10880
|
-
*
|
|
10881
|
-
* // Generate chat completions with AI Search context
|
|
10882
|
-
* const response = await env.AI.aiSearch.get('my-search').chatCompletions({
|
|
10883
|
-
* messages: [{ role: 'user', content: 'What is the policy?' }],
|
|
10884
|
-
* model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'
|
|
10885
|
-
* });
|
|
10886
|
-
* ```
|
|
11172
|
+
* @deprecated Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
11173
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10887
11174
|
*/
|
|
10888
|
-
aiSearch():
|
|
11175
|
+
aiSearch(): AiSearchNamespace;
|
|
10889
11176
|
/**
|
|
10890
11177
|
* @deprecated AutoRAG has been replaced by AI Search.
|
|
10891
|
-
* Use `
|
|
11178
|
+
* Use the standalone `ai_search_namespaces` or `ai_search` Workers bindings instead.
|
|
11179
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
10892
11180
|
*
|
|
10893
|
-
*
|
|
10894
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
10895
|
-
* - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`
|
|
10896
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
10897
|
-
*
|
|
10898
|
-
* Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.
|
|
10899
|
-
*
|
|
10900
|
-
* @see AiSearchAccountService
|
|
10901
|
-
* @param autoragId Optional instance ID (omit for account-level operations)
|
|
11181
|
+
* @param autoragId Instance ID
|
|
10902
11182
|
*/
|
|
10903
11183
|
autorag(autoragId: string): AutoRAG;
|
|
10904
11184
|
run<
|
|
@@ -11057,22 +11337,23 @@ export declare abstract class AiGateway {
|
|
|
11057
11337
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
11058
11338
|
}
|
|
11059
11339
|
/**
|
|
11060
|
-
* @deprecated
|
|
11061
|
-
*
|
|
11340
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11341
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11062
11342
|
*/
|
|
11063
11343
|
export interface AutoRAGInternalError extends Error {}
|
|
11064
11344
|
/**
|
|
11065
|
-
* @deprecated
|
|
11066
|
-
*
|
|
11345
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11346
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11067
11347
|
*/
|
|
11068
11348
|
export interface AutoRAGNotFoundError extends Error {}
|
|
11069
11349
|
/**
|
|
11070
|
-
* @deprecated
|
|
11350
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11351
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11071
11352
|
*/
|
|
11072
11353
|
export interface AutoRAGUnauthorizedError extends Error {}
|
|
11073
11354
|
/**
|
|
11074
|
-
* @deprecated
|
|
11075
|
-
*
|
|
11355
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11356
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11076
11357
|
*/
|
|
11077
11358
|
export interface AutoRAGNameNotSetError extends Error {}
|
|
11078
11359
|
export type ComparisonFilter = {
|
|
@@ -11085,9 +11366,8 @@ export type CompoundFilter = {
|
|
|
11085
11366
|
filters: ComparisonFilter[];
|
|
11086
11367
|
};
|
|
11087
11368
|
/**
|
|
11088
|
-
* @deprecated
|
|
11089
|
-
*
|
|
11090
|
-
* @see AiSearchSearchRequest
|
|
11369
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11370
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11091
11371
|
*/
|
|
11092
11372
|
export type AutoRagSearchRequest = {
|
|
11093
11373
|
query: string;
|
|
@@ -11104,18 +11384,16 @@ export type AutoRagSearchRequest = {
|
|
|
11104
11384
|
rewrite_query?: boolean;
|
|
11105
11385
|
};
|
|
11106
11386
|
/**
|
|
11107
|
-
* @deprecated
|
|
11108
|
-
*
|
|
11109
|
-
* @see AiSearchChatCompletionsRequest
|
|
11387
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11388
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11110
11389
|
*/
|
|
11111
11390
|
export type AutoRagAiSearchRequest = AutoRagSearchRequest & {
|
|
11112
11391
|
stream?: boolean;
|
|
11113
11392
|
system_prompt?: string;
|
|
11114
11393
|
};
|
|
11115
11394
|
/**
|
|
11116
|
-
* @deprecated
|
|
11117
|
-
*
|
|
11118
|
-
* @see AiSearchChatCompletionsRequest
|
|
11395
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11396
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11119
11397
|
*/
|
|
11120
11398
|
export type AutoRagAiSearchRequestStreaming = Omit<
|
|
11121
11399
|
AutoRagAiSearchRequest,
|
|
@@ -11124,9 +11402,8 @@ export type AutoRagAiSearchRequestStreaming = Omit<
|
|
|
11124
11402
|
stream: true;
|
|
11125
11403
|
};
|
|
11126
11404
|
/**
|
|
11127
|
-
* @deprecated
|
|
11128
|
-
*
|
|
11129
|
-
* @see AiSearchSearchResponse
|
|
11405
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11406
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11130
11407
|
*/
|
|
11131
11408
|
export type AutoRagSearchResponse = {
|
|
11132
11409
|
object: "vector_store.search_results.page";
|
|
@@ -11145,9 +11422,8 @@ export type AutoRagSearchResponse = {
|
|
|
11145
11422
|
next_page: string | null;
|
|
11146
11423
|
};
|
|
11147
11424
|
/**
|
|
11148
|
-
* @deprecated
|
|
11149
|
-
*
|
|
11150
|
-
* @see AiSearchListResponse
|
|
11425
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11426
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11151
11427
|
*/
|
|
11152
11428
|
export type AutoRagListResponse = {
|
|
11153
11429
|
id: string;
|
|
@@ -11159,49 +11435,40 @@ export type AutoRagListResponse = {
|
|
|
11159
11435
|
status: string;
|
|
11160
11436
|
}[];
|
|
11161
11437
|
/**
|
|
11162
|
-
* @deprecated
|
|
11163
|
-
*
|
|
11438
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11439
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11164
11440
|
*/
|
|
11165
11441
|
export type AutoRagAiSearchResponse = AutoRagSearchResponse & {
|
|
11166
11442
|
response: string;
|
|
11167
11443
|
};
|
|
11168
11444
|
/**
|
|
11169
|
-
* @deprecated
|
|
11170
|
-
*
|
|
11171
|
-
*
|
|
11172
|
-
* Migration guide:
|
|
11173
|
-
* - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`
|
|
11174
|
-
* - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`
|
|
11175
|
-
* - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`
|
|
11176
|
-
*
|
|
11177
|
-
* @see AiSearchAccountService
|
|
11178
|
-
* @see AiSearchInstanceService
|
|
11445
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11446
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11179
11447
|
*/
|
|
11180
11448
|
export declare abstract class AutoRAG {
|
|
11181
11449
|
/**
|
|
11182
|
-
* @deprecated Use
|
|
11183
|
-
*
|
|
11450
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11451
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11184
11452
|
*/
|
|
11185
11453
|
list(): Promise<AutoRagListResponse>;
|
|
11186
11454
|
/**
|
|
11187
|
-
* @deprecated Use
|
|
11188
|
-
*
|
|
11189
|
-
* @see AiSearchInstanceService.search
|
|
11455
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11456
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11190
11457
|
*/
|
|
11191
11458
|
search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;
|
|
11192
11459
|
/**
|
|
11193
|
-
* @deprecated Use
|
|
11194
|
-
*
|
|
11460
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11461
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11195
11462
|
*/
|
|
11196
11463
|
aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;
|
|
11197
11464
|
/**
|
|
11198
|
-
* @deprecated Use
|
|
11199
|
-
*
|
|
11465
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11466
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11200
11467
|
*/
|
|
11201
11468
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;
|
|
11202
11469
|
/**
|
|
11203
|
-
* @deprecated Use
|
|
11204
|
-
*
|
|
11470
|
+
* @deprecated Use the standalone AI Search Workers binding instead.
|
|
11471
|
+
* See https://developers.cloudflare.com/ai-search/usage/workers-binding/
|
|
11205
11472
|
*/
|
|
11206
11473
|
aiSearch(
|
|
11207
11474
|
params: AutoRagAiSearchRequest,
|