@cloudflare/workers-types 4.20240722.0 → 4.20240729.0

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.
@@ -1610,8 +1610,6 @@ interface RequestInit<Cf = CfProperties> {
1610
1610
  redirect?: string;
1611
1611
  fetcher?: Fetcher | null;
1612
1612
  cf?: Cf;
1613
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1614
- cache?: string;
1615
1613
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1616
1614
  integrity?: string;
1617
1615
  /* An AbortSignal to set request's signal. */
@@ -3491,6 +3489,7 @@ type BaseAiSpeechRecognitionModels =
3491
3489
  type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3492
3490
  type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3493
3491
  type BaseAiTextGenerationModels =
3492
+ | "@cf/meta/llama-3.1-8b-instruct"
3494
3493
  | "@cf/meta/llama-3-8b-instruct"
3495
3494
  | "@cf/meta/llama-3-8b-instruct-awq"
3496
3495
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4587,7 +4586,7 @@ declare abstract class D1PreparedStatement {
4587
4586
  bind(...values: unknown[]): D1PreparedStatement;
4588
4587
  first<T = unknown>(colName: string): Promise<T | null>;
4589
4588
  first<T = Record<string, unknown>>(): Promise<T | null>;
4590
- run(): Promise<D1Response>;
4589
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4591
4590
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4592
4591
  raw<T = unknown[]>(options: {
4593
4592
  columnNames: true;
@@ -5056,11 +5055,23 @@ type VectorizeVectorMetadataFilter = {
5056
5055
  * Distance metrics determine how other "similar" vectors are determined.
5057
5056
  */
5058
5057
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5059
- interface VectorizeQueryOptions {
5058
+ /**
5059
+ * Metadata return levels for a Vectorize query.
5060
+ *
5061
+ * Default to "none".
5062
+ *
5063
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
5064
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
5065
+ * @property none No indexed metadata will be returned.
5066
+ */
5067
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5068
+ interface VectorizeQueryOptions<
5069
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5070
+ > {
5060
5071
  topK?: number;
5061
5072
  namespace?: string;
5062
5073
  returnValues?: boolean;
5063
- returnMetadata?: boolean;
5074
+ returnMetadata?: MetadataReturn;
5064
5075
  filter?: VectorizeVectorMetadataFilter;
5065
5076
  }
5066
5077
  /**
@@ -5076,6 +5087,9 @@ type VectorizeIndexConfig =
5076
5087
  };
5077
5088
  /**
5078
5089
  * Metadata about an existing index.
5090
+ *
5091
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5092
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5079
5093
  */
5080
5094
  interface VectorizeIndexDetails {
5081
5095
  /** The unique ID of the index */
@@ -5089,6 +5103,19 @@ interface VectorizeIndexDetails {
5089
5103
  /** The number of records containing vectors within the index. */
5090
5104
  vectorsCount: number;
5091
5105
  }
5106
+ /**
5107
+ * Metadata about an existing index.
5108
+ */
5109
+ interface VectorizeIndexInfo {
5110
+ /** The number of records containing vectors within the index. */
5111
+ vectorsCount: number;
5112
+ /** Number of dimensions the index has been configured for. */
5113
+ dimensions: number;
5114
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5115
+ processedUpToDatetime: number;
5116
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5117
+ processedUpToMutation: number;
5118
+ }
5092
5119
  /**
5093
5120
  * Represents a single vector value set along with its associated metadata.
5094
5121
  */
@@ -5099,7 +5126,7 @@ interface VectorizeVector {
5099
5126
  values: VectorFloatArray | number[];
5100
5127
  /** The namespace this vector belongs to. */
5101
5128
  namespace?: string;
5102
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5129
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5103
5130
  metadata?: Record<string, VectorizeVectorMetadata>;
5104
5131
  }
5105
5132
  /**
@@ -5111,7 +5138,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5111
5138
  score: number;
5112
5139
  };
5113
5140
  /**
5114
- * A set of vector {@link VectorizeMatch} for a particular query.
5141
+ * A set of matching {@link VectorizeMatch} for a particular query.
5115
5142
  */
5116
5143
  interface VectorizeMatches {
5117
5144
  matches: VectorizeMatch[];
@@ -5120,6 +5147,9 @@ interface VectorizeMatches {
5120
5147
  /**
5121
5148
  * Results of an operation that performed a mutation on a set of vectors.
5122
5149
  * Here, `ids` is a list of vectors that were successfully processed.
5150
+ *
5151
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5152
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5123
5153
  */
5124
5154
  interface VectorizeVectorMutation {
5125
5155
  /* List of ids of vectors that were successfully processed. */
@@ -5128,14 +5158,19 @@ interface VectorizeVectorMutation {
5128
5158
  count: number;
5129
5159
  }
5130
5160
  /**
5131
- * Results of an operation that performed a mutation on a set of vectors
5132
- * with the v2 version of Vectorize.
5133
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5161
+ * Result type indicating a mutation on the Vectorize Index.
5162
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5134
5163
  */
5135
- interface VectorizeVectorMutationV2 {
5136
- /* The identifier for the last mutation processed by Vectorize. */
5164
+ interface VectorizeAsyncMutation {
5165
+ /** The unique identifier for the async mutation operation containing the changeset. */
5137
5166
  mutationId: string;
5138
5167
  }
5168
+ /**
5169
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5170
+ *
5171
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5172
+ * See {@link Vectorize} for its new implementation.
5173
+ */
5139
5174
  declare abstract class VectorizeIndex {
5140
5175
  /**
5141
5176
  * Get information about the currently bound index.
@@ -5177,6 +5212,52 @@ declare abstract class VectorizeIndex {
5177
5212
  */
5178
5213
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5179
5214
  }
5215
+ /**
5216
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5217
+ *
5218
+ * Mutations in this version are async, returning a mutation id.
5219
+ */
5220
+ declare abstract class Vectorize {
5221
+ /**
5222
+ * Get information about the currently bound index.
5223
+ * @returns A promise that resolves with information about the current index.
5224
+ */
5225
+ public describe(): Promise<VectorizeIndexInfo>;
5226
+ /**
5227
+ * Use the provided vector to perform a similarity search across the index.
5228
+ * @param vector Input vector that will be used to drive the similarity search.
5229
+ * @param options Configuration options to massage the returned data.
5230
+ * @returns A promise that resolves with matched and scored vectors.
5231
+ */
5232
+ public query(
5233
+ vector: VectorFloatArray | number[],
5234
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5235
+ ): Promise<VectorizeMatches>;
5236
+ /**
5237
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5238
+ * @param vectors List of vectors that will be inserted.
5239
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5240
+ */
5241
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5242
+ /**
5243
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5244
+ * @param vectors List of vectors that will be upserted.
5245
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5246
+ */
5247
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5248
+ /**
5249
+ * Delete a list of vectors with a matching id.
5250
+ * @param ids List of vector ids that should be deleted.
5251
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5252
+ */
5253
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5254
+ /**
5255
+ * Get a list of vectors with a matching id.
5256
+ * @param ids List of vector ids that should be returned.
5257
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5258
+ */
5259
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5260
+ }
5180
5261
  /**
5181
5262
  * The interface for "version_metadata" binding
5182
5263
  * providing metadata about the Worker Version using this binding.
@@ -1615,8 +1615,6 @@ export interface RequestInit<Cf = CfProperties> {
1615
1615
  redirect?: string;
1616
1616
  fetcher?: Fetcher | null;
1617
1617
  cf?: Cf;
1618
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1619
- cache?: string;
1620
1618
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1621
1619
  integrity?: string;
1622
1620
  /* An AbortSignal to set request's signal. */
@@ -3501,6 +3499,7 @@ export type BaseAiSpeechRecognitionModels =
3501
3499
  export type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3502
3500
  export type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3503
3501
  export type BaseAiTextGenerationModels =
3502
+ | "@cf/meta/llama-3.1-8b-instruct"
3504
3503
  | "@cf/meta/llama-3-8b-instruct"
3505
3504
  | "@cf/meta/llama-3-8b-instruct-awq"
3506
3505
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4609,7 +4608,7 @@ export declare abstract class D1PreparedStatement {
4609
4608
  bind(...values: unknown[]): D1PreparedStatement;
4610
4609
  first<T = unknown>(colName: string): Promise<T | null>;
4611
4610
  first<T = Record<string, unknown>>(): Promise<T | null>;
4612
- run(): Promise<D1Response>;
4611
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4613
4612
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4614
4613
  raw<T = unknown[]>(options: {
4615
4614
  columnNames: true;
@@ -5016,11 +5015,23 @@ export type VectorizeVectorMetadataFilter = {
5016
5015
  * Distance metrics determine how other "similar" vectors are determined.
5017
5016
  */
5018
5017
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5019
- export interface VectorizeQueryOptions {
5018
+ /**
5019
+ * Metadata return levels for a Vectorize query.
5020
+ *
5021
+ * Default to "none".
5022
+ *
5023
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
5024
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
5025
+ * @property none No indexed metadata will be returned.
5026
+ */
5027
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5028
+ export interface VectorizeQueryOptions<
5029
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5030
+ > {
5020
5031
  topK?: number;
5021
5032
  namespace?: string;
5022
5033
  returnValues?: boolean;
5023
- returnMetadata?: boolean;
5034
+ returnMetadata?: MetadataReturn;
5024
5035
  filter?: VectorizeVectorMetadataFilter;
5025
5036
  }
5026
5037
  /**
@@ -5036,6 +5047,9 @@ export type VectorizeIndexConfig =
5036
5047
  };
5037
5048
  /**
5038
5049
  * Metadata about an existing index.
5050
+ *
5051
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5052
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5039
5053
  */
5040
5054
  export interface VectorizeIndexDetails {
5041
5055
  /** The unique ID of the index */
@@ -5049,6 +5063,19 @@ export interface VectorizeIndexDetails {
5049
5063
  /** The number of records containing vectors within the index. */
5050
5064
  vectorsCount: number;
5051
5065
  }
5066
+ /**
5067
+ * Metadata about an existing index.
5068
+ */
5069
+ export interface VectorizeIndexInfo {
5070
+ /** The number of records containing vectors within the index. */
5071
+ vectorsCount: number;
5072
+ /** Number of dimensions the index has been configured for. */
5073
+ dimensions: number;
5074
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5075
+ processedUpToDatetime: number;
5076
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5077
+ processedUpToMutation: number;
5078
+ }
5052
5079
  /**
5053
5080
  * Represents a single vector value set along with its associated metadata.
5054
5081
  */
@@ -5059,7 +5086,7 @@ export interface VectorizeVector {
5059
5086
  values: VectorFloatArray | number[];
5060
5087
  /** The namespace this vector belongs to. */
5061
5088
  namespace?: string;
5062
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5089
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5063
5090
  metadata?: Record<string, VectorizeVectorMetadata>;
5064
5091
  }
5065
5092
  /**
@@ -5071,7 +5098,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5071
5098
  score: number;
5072
5099
  };
5073
5100
  /**
5074
- * A set of vector {@link VectorizeMatch} for a particular query.
5101
+ * A set of matching {@link VectorizeMatch} for a particular query.
5075
5102
  */
5076
5103
  export interface VectorizeMatches {
5077
5104
  matches: VectorizeMatch[];
@@ -5080,6 +5107,9 @@ export interface VectorizeMatches {
5080
5107
  /**
5081
5108
  * Results of an operation that performed a mutation on a set of vectors.
5082
5109
  * Here, `ids` is a list of vectors that were successfully processed.
5110
+ *
5111
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5112
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5083
5113
  */
5084
5114
  export interface VectorizeVectorMutation {
5085
5115
  /* List of ids of vectors that were successfully processed. */
@@ -5088,14 +5118,19 @@ export interface VectorizeVectorMutation {
5088
5118
  count: number;
5089
5119
  }
5090
5120
  /**
5091
- * Results of an operation that performed a mutation on a set of vectors
5092
- * with the v2 version of Vectorize.
5093
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5121
+ * Result type indicating a mutation on the Vectorize Index.
5122
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5094
5123
  */
5095
- export interface VectorizeVectorMutationV2 {
5096
- /* The identifier for the last mutation processed by Vectorize. */
5124
+ export interface VectorizeAsyncMutation {
5125
+ /** The unique identifier for the async mutation operation containing the changeset. */
5097
5126
  mutationId: string;
5098
5127
  }
5128
+ /**
5129
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5130
+ *
5131
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5132
+ * See {@link Vectorize} for its new implementation.
5133
+ */
5099
5134
  export declare abstract class VectorizeIndex {
5100
5135
  /**
5101
5136
  * Get information about the currently bound index.
@@ -5137,6 +5172,52 @@ export declare abstract class VectorizeIndex {
5137
5172
  */
5138
5173
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5139
5174
  }
5175
+ /**
5176
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5177
+ *
5178
+ * Mutations in this version are async, returning a mutation id.
5179
+ */
5180
+ export declare abstract class Vectorize {
5181
+ /**
5182
+ * Get information about the currently bound index.
5183
+ * @returns A promise that resolves with information about the current index.
5184
+ */
5185
+ public describe(): Promise<VectorizeIndexInfo>;
5186
+ /**
5187
+ * Use the provided vector to perform a similarity search across the index.
5188
+ * @param vector Input vector that will be used to drive the similarity search.
5189
+ * @param options Configuration options to massage the returned data.
5190
+ * @returns A promise that resolves with matched and scored vectors.
5191
+ */
5192
+ public query(
5193
+ vector: VectorFloatArray | number[],
5194
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5195
+ ): Promise<VectorizeMatches>;
5196
+ /**
5197
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5198
+ * @param vectors List of vectors that will be inserted.
5199
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5200
+ */
5201
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5202
+ /**
5203
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5204
+ * @param vectors List of vectors that will be upserted.
5205
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5206
+ */
5207
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5208
+ /**
5209
+ * Delete a list of vectors with a matching id.
5210
+ * @param ids List of vector ids that should be deleted.
5211
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5212
+ */
5213
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5214
+ /**
5215
+ * Get a list of vectors with a matching id.
5216
+ * @param ids List of vector ids that should be returned.
5217
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5218
+ */
5219
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5220
+ }
5140
5221
  /**
5141
5222
  * The interface for "version_metadata" binding
5142
5223
  * providing metadata about the Worker Version using this binding.
@@ -1604,12 +1604,6 @@ declare class Request<
1604
1604
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1605
1605
  */
1606
1606
  get keepalive(): boolean;
1607
- /**
1608
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1609
- *
1610
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1611
- */
1612
- get cache(): string | undefined;
1613
1607
  }
1614
1608
  interface RequestInit<Cf = CfProperties> {
1615
1609
  /* A string to set request's method. */
@@ -1622,8 +1616,6 @@ interface RequestInit<Cf = CfProperties> {
1622
1616
  redirect?: string;
1623
1617
  fetcher?: Fetcher | null;
1624
1618
  cf?: Cf;
1625
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1626
- cache?: string;
1627
1619
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1628
1620
  integrity?: string;
1629
1621
  /* An AbortSignal to set request's signal. */
@@ -3523,6 +3515,7 @@ type BaseAiSpeechRecognitionModels =
3523
3515
  type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3524
3516
  type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3525
3517
  type BaseAiTextGenerationModels =
3518
+ | "@cf/meta/llama-3.1-8b-instruct"
3526
3519
  | "@cf/meta/llama-3-8b-instruct"
3527
3520
  | "@cf/meta/llama-3-8b-instruct-awq"
3528
3521
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4619,7 +4612,7 @@ declare abstract class D1PreparedStatement {
4619
4612
  bind(...values: unknown[]): D1PreparedStatement;
4620
4613
  first<T = unknown>(colName: string): Promise<T | null>;
4621
4614
  first<T = Record<string, unknown>>(): Promise<T | null>;
4622
- run(): Promise<D1Response>;
4615
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4623
4616
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4624
4617
  raw<T = unknown[]>(options: {
4625
4618
  columnNames: true;
@@ -5088,11 +5081,23 @@ type VectorizeVectorMetadataFilter = {
5088
5081
  * Distance metrics determine how other "similar" vectors are determined.
5089
5082
  */
5090
5083
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5091
- interface VectorizeQueryOptions {
5084
+ /**
5085
+ * Metadata return levels for a Vectorize query.
5086
+ *
5087
+ * Default to "none".
5088
+ *
5089
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
5090
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
5091
+ * @property none No indexed metadata will be returned.
5092
+ */
5093
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5094
+ interface VectorizeQueryOptions<
5095
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5096
+ > {
5092
5097
  topK?: number;
5093
5098
  namespace?: string;
5094
5099
  returnValues?: boolean;
5095
- returnMetadata?: boolean;
5100
+ returnMetadata?: MetadataReturn;
5096
5101
  filter?: VectorizeVectorMetadataFilter;
5097
5102
  }
5098
5103
  /**
@@ -5108,6 +5113,9 @@ type VectorizeIndexConfig =
5108
5113
  };
5109
5114
  /**
5110
5115
  * Metadata about an existing index.
5116
+ *
5117
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5118
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5111
5119
  */
5112
5120
  interface VectorizeIndexDetails {
5113
5121
  /** The unique ID of the index */
@@ -5121,6 +5129,19 @@ interface VectorizeIndexDetails {
5121
5129
  /** The number of records containing vectors within the index. */
5122
5130
  vectorsCount: number;
5123
5131
  }
5132
+ /**
5133
+ * Metadata about an existing index.
5134
+ */
5135
+ interface VectorizeIndexInfo {
5136
+ /** The number of records containing vectors within the index. */
5137
+ vectorsCount: number;
5138
+ /** Number of dimensions the index has been configured for. */
5139
+ dimensions: number;
5140
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5141
+ processedUpToDatetime: number;
5142
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5143
+ processedUpToMutation: number;
5144
+ }
5124
5145
  /**
5125
5146
  * Represents a single vector value set along with its associated metadata.
5126
5147
  */
@@ -5131,7 +5152,7 @@ interface VectorizeVector {
5131
5152
  values: VectorFloatArray | number[];
5132
5153
  /** The namespace this vector belongs to. */
5133
5154
  namespace?: string;
5134
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5155
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5135
5156
  metadata?: Record<string, VectorizeVectorMetadata>;
5136
5157
  }
5137
5158
  /**
@@ -5143,7 +5164,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5143
5164
  score: number;
5144
5165
  };
5145
5166
  /**
5146
- * A set of vector {@link VectorizeMatch} for a particular query.
5167
+ * A set of matching {@link VectorizeMatch} for a particular query.
5147
5168
  */
5148
5169
  interface VectorizeMatches {
5149
5170
  matches: VectorizeMatch[];
@@ -5152,6 +5173,9 @@ interface VectorizeMatches {
5152
5173
  /**
5153
5174
  * Results of an operation that performed a mutation on a set of vectors.
5154
5175
  * Here, `ids` is a list of vectors that were successfully processed.
5176
+ *
5177
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5178
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5155
5179
  */
5156
5180
  interface VectorizeVectorMutation {
5157
5181
  /* List of ids of vectors that were successfully processed. */
@@ -5160,14 +5184,19 @@ interface VectorizeVectorMutation {
5160
5184
  count: number;
5161
5185
  }
5162
5186
  /**
5163
- * Results of an operation that performed a mutation on a set of vectors
5164
- * with the v2 version of Vectorize.
5165
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5187
+ * Result type indicating a mutation on the Vectorize Index.
5188
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5166
5189
  */
5167
- interface VectorizeVectorMutationV2 {
5168
- /* The identifier for the last mutation processed by Vectorize. */
5190
+ interface VectorizeAsyncMutation {
5191
+ /** The unique identifier for the async mutation operation containing the changeset. */
5169
5192
  mutationId: string;
5170
5193
  }
5194
+ /**
5195
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5196
+ *
5197
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5198
+ * See {@link Vectorize} for its new implementation.
5199
+ */
5171
5200
  declare abstract class VectorizeIndex {
5172
5201
  /**
5173
5202
  * Get information about the currently bound index.
@@ -5209,6 +5238,52 @@ declare abstract class VectorizeIndex {
5209
5238
  */
5210
5239
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5211
5240
  }
5241
+ /**
5242
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5243
+ *
5244
+ * Mutations in this version are async, returning a mutation id.
5245
+ */
5246
+ declare abstract class Vectorize {
5247
+ /**
5248
+ * Get information about the currently bound index.
5249
+ * @returns A promise that resolves with information about the current index.
5250
+ */
5251
+ public describe(): Promise<VectorizeIndexInfo>;
5252
+ /**
5253
+ * Use the provided vector to perform a similarity search across the index.
5254
+ * @param vector Input vector that will be used to drive the similarity search.
5255
+ * @param options Configuration options to massage the returned data.
5256
+ * @returns A promise that resolves with matched and scored vectors.
5257
+ */
5258
+ public query(
5259
+ vector: VectorFloatArray | number[],
5260
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5261
+ ): Promise<VectorizeMatches>;
5262
+ /**
5263
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5264
+ * @param vectors List of vectors that will be inserted.
5265
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5266
+ */
5267
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5268
+ /**
5269
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5270
+ * @param vectors List of vectors that will be upserted.
5271
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5272
+ */
5273
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5274
+ /**
5275
+ * Delete a list of vectors with a matching id.
5276
+ * @param ids List of vector ids that should be deleted.
5277
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5278
+ */
5279
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5280
+ /**
5281
+ * Get a list of vectors with a matching id.
5282
+ * @param ids List of vector ids that should be returned.
5283
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5284
+ */
5285
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5286
+ }
5212
5287
  /**
5213
5288
  * The interface for "version_metadata" binding
5214
5289
  * providing metadata about the Worker Version using this binding.