@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.
@@ -1633,12 +1633,6 @@ export declare class Request<
1633
1633
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1634
1634
  */
1635
1635
  get keepalive(): boolean;
1636
- /**
1637
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1638
- *
1639
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1640
- */
1641
- get cache(): string | undefined;
1642
1636
  }
1643
1637
  export interface RequestInit<Cf = CfProperties> {
1644
1638
  /* A string to set request's method. */
@@ -1651,8 +1645,6 @@ export interface RequestInit<Cf = CfProperties> {
1651
1645
  redirect?: string;
1652
1646
  fetcher?: Fetcher | null;
1653
1647
  cf?: Cf;
1654
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1655
- cache?: string;
1656
1648
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1657
1649
  integrity?: string;
1658
1650
  /* An AbortSignal to set request's signal. */
@@ -3564,6 +3556,7 @@ export type BaseAiSpeechRecognitionModels =
3564
3556
  export type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3565
3557
  export type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3566
3558
  export type BaseAiTextGenerationModels =
3559
+ | "@cf/meta/llama-3.1-8b-instruct"
3567
3560
  | "@cf/meta/llama-3-8b-instruct"
3568
3561
  | "@cf/meta/llama-3-8b-instruct-awq"
3569
3562
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4672,7 +4665,7 @@ export declare abstract class D1PreparedStatement {
4672
4665
  bind(...values: unknown[]): D1PreparedStatement;
4673
4666
  first<T = unknown>(colName: string): Promise<T | null>;
4674
4667
  first<T = Record<string, unknown>>(): Promise<T | null>;
4675
- run(): Promise<D1Response>;
4668
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4676
4669
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4677
4670
  raw<T = unknown[]>(options: {
4678
4671
  columnNames: true;
@@ -5079,11 +5072,23 @@ export type VectorizeVectorMetadataFilter = {
5079
5072
  * Distance metrics determine how other "similar" vectors are determined.
5080
5073
  */
5081
5074
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5082
- export interface VectorizeQueryOptions {
5075
+ /**
5076
+ * Metadata return levels for a Vectorize query.
5077
+ *
5078
+ * Default to "none".
5079
+ *
5080
+ * @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.
5081
+ * @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).
5082
+ * @property none No indexed metadata will be returned.
5083
+ */
5084
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5085
+ export interface VectorizeQueryOptions<
5086
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5087
+ > {
5083
5088
  topK?: number;
5084
5089
  namespace?: string;
5085
5090
  returnValues?: boolean;
5086
- returnMetadata?: boolean;
5091
+ returnMetadata?: MetadataReturn;
5087
5092
  filter?: VectorizeVectorMetadataFilter;
5088
5093
  }
5089
5094
  /**
@@ -5099,6 +5104,9 @@ export type VectorizeIndexConfig =
5099
5104
  };
5100
5105
  /**
5101
5106
  * Metadata about an existing index.
5107
+ *
5108
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5109
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5102
5110
  */
5103
5111
  export interface VectorizeIndexDetails {
5104
5112
  /** The unique ID of the index */
@@ -5112,6 +5120,19 @@ export interface VectorizeIndexDetails {
5112
5120
  /** The number of records containing vectors within the index. */
5113
5121
  vectorsCount: number;
5114
5122
  }
5123
+ /**
5124
+ * Metadata about an existing index.
5125
+ */
5126
+ export interface VectorizeIndexInfo {
5127
+ /** The number of records containing vectors within the index. */
5128
+ vectorsCount: number;
5129
+ /** Number of dimensions the index has been configured for. */
5130
+ dimensions: number;
5131
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5132
+ processedUpToDatetime: number;
5133
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5134
+ processedUpToMutation: number;
5135
+ }
5115
5136
  /**
5116
5137
  * Represents a single vector value set along with its associated metadata.
5117
5138
  */
@@ -5122,7 +5143,7 @@ export interface VectorizeVector {
5122
5143
  values: VectorFloatArray | number[];
5123
5144
  /** The namespace this vector belongs to. */
5124
5145
  namespace?: string;
5125
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5146
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5126
5147
  metadata?: Record<string, VectorizeVectorMetadata>;
5127
5148
  }
5128
5149
  /**
@@ -5134,7 +5155,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5134
5155
  score: number;
5135
5156
  };
5136
5157
  /**
5137
- * A set of vector {@link VectorizeMatch} for a particular query.
5158
+ * A set of matching {@link VectorizeMatch} for a particular query.
5138
5159
  */
5139
5160
  export interface VectorizeMatches {
5140
5161
  matches: VectorizeMatch[];
@@ -5143,6 +5164,9 @@ export interface VectorizeMatches {
5143
5164
  /**
5144
5165
  * Results of an operation that performed a mutation on a set of vectors.
5145
5166
  * Here, `ids` is a list of vectors that were successfully processed.
5167
+ *
5168
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5169
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5146
5170
  */
5147
5171
  export interface VectorizeVectorMutation {
5148
5172
  /* List of ids of vectors that were successfully processed. */
@@ -5151,14 +5175,19 @@ export interface VectorizeVectorMutation {
5151
5175
  count: number;
5152
5176
  }
5153
5177
  /**
5154
- * Results of an operation that performed a mutation on a set of vectors
5155
- * with the v2 version of Vectorize.
5156
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5178
+ * Result type indicating a mutation on the Vectorize Index.
5179
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5157
5180
  */
5158
- export interface VectorizeVectorMutationV2 {
5159
- /* The identifier for the last mutation processed by Vectorize. */
5181
+ export interface VectorizeAsyncMutation {
5182
+ /** The unique identifier for the async mutation operation containing the changeset. */
5160
5183
  mutationId: string;
5161
5184
  }
5185
+ /**
5186
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5187
+ *
5188
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5189
+ * See {@link Vectorize} for its new implementation.
5190
+ */
5162
5191
  export declare abstract class VectorizeIndex {
5163
5192
  /**
5164
5193
  * Get information about the currently bound index.
@@ -5200,6 +5229,52 @@ export declare abstract class VectorizeIndex {
5200
5229
  */
5201
5230
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5202
5231
  }
5232
+ /**
5233
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5234
+ *
5235
+ * Mutations in this version are async, returning a mutation id.
5236
+ */
5237
+ export declare abstract class Vectorize {
5238
+ /**
5239
+ * Get information about the currently bound index.
5240
+ * @returns A promise that resolves with information about the current index.
5241
+ */
5242
+ public describe(): Promise<VectorizeIndexInfo>;
5243
+ /**
5244
+ * Use the provided vector to perform a similarity search across the index.
5245
+ * @param vector Input vector that will be used to drive the similarity search.
5246
+ * @param options Configuration options to massage the returned data.
5247
+ * @returns A promise that resolves with matched and scored vectors.
5248
+ */
5249
+ public query(
5250
+ vector: VectorFloatArray | number[],
5251
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5252
+ ): Promise<VectorizeMatches>;
5253
+ /**
5254
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5255
+ * @param vectors List of vectors that will be inserted.
5256
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5257
+ */
5258
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5259
+ /**
5260
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5261
+ * @param vectors List of vectors that will be upserted.
5262
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5263
+ */
5264
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5265
+ /**
5266
+ * Delete a list of vectors with a matching id.
5267
+ * @param ids List of vector ids that should be deleted.
5268
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5269
+ */
5270
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5271
+ /**
5272
+ * Get a list of vectors with a matching id.
5273
+ * @param ids List of vector ids that should be returned.
5274
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5275
+ */
5276
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5277
+ }
5203
5278
  /**
5204
5279
  * The interface for "version_metadata" binding
5205
5280
  * providing metadata about the Worker Version using this binding.
@@ -1638,12 +1638,6 @@ declare class Request<
1638
1638
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1639
1639
  */
1640
1640
  get keepalive(): boolean;
1641
- /**
1642
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1643
- *
1644
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1645
- */
1646
- get cache(): string | undefined;
1647
1641
  }
1648
1642
  interface RequestInit<Cf = CfProperties> {
1649
1643
  /* A string to set request's method. */
@@ -1656,8 +1650,6 @@ interface RequestInit<Cf = CfProperties> {
1656
1650
  redirect?: string;
1657
1651
  fetcher?: Fetcher | null;
1658
1652
  cf?: Cf;
1659
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1660
- cache?: string;
1661
1653
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1662
1654
  integrity?: string;
1663
1655
  /* An AbortSignal to set request's signal. */
@@ -3629,6 +3621,7 @@ type BaseAiSpeechRecognitionModels =
3629
3621
  type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3630
3622
  type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3631
3623
  type BaseAiTextGenerationModels =
3624
+ | "@cf/meta/llama-3.1-8b-instruct"
3632
3625
  | "@cf/meta/llama-3-8b-instruct"
3633
3626
  | "@cf/meta/llama-3-8b-instruct-awq"
3634
3627
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4725,7 +4718,7 @@ declare abstract class D1PreparedStatement {
4725
4718
  bind(...values: unknown[]): D1PreparedStatement;
4726
4719
  first<T = unknown>(colName: string): Promise<T | null>;
4727
4720
  first<T = Record<string, unknown>>(): Promise<T | null>;
4728
- run(): Promise<D1Response>;
4721
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4729
4722
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4730
4723
  raw<T = unknown[]>(options: {
4731
4724
  columnNames: true;
@@ -5194,11 +5187,23 @@ type VectorizeVectorMetadataFilter = {
5194
5187
  * Distance metrics determine how other "similar" vectors are determined.
5195
5188
  */
5196
5189
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5197
- interface VectorizeQueryOptions {
5190
+ /**
5191
+ * Metadata return levels for a Vectorize query.
5192
+ *
5193
+ * Default to "none".
5194
+ *
5195
+ * @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.
5196
+ * @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).
5197
+ * @property none No indexed metadata will be returned.
5198
+ */
5199
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5200
+ interface VectorizeQueryOptions<
5201
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5202
+ > {
5198
5203
  topK?: number;
5199
5204
  namespace?: string;
5200
5205
  returnValues?: boolean;
5201
- returnMetadata?: boolean;
5206
+ returnMetadata?: MetadataReturn;
5202
5207
  filter?: VectorizeVectorMetadataFilter;
5203
5208
  }
5204
5209
  /**
@@ -5214,6 +5219,9 @@ type VectorizeIndexConfig =
5214
5219
  };
5215
5220
  /**
5216
5221
  * Metadata about an existing index.
5222
+ *
5223
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5224
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5217
5225
  */
5218
5226
  interface VectorizeIndexDetails {
5219
5227
  /** The unique ID of the index */
@@ -5227,6 +5235,19 @@ interface VectorizeIndexDetails {
5227
5235
  /** The number of records containing vectors within the index. */
5228
5236
  vectorsCount: number;
5229
5237
  }
5238
+ /**
5239
+ * Metadata about an existing index.
5240
+ */
5241
+ interface VectorizeIndexInfo {
5242
+ /** The number of records containing vectors within the index. */
5243
+ vectorsCount: number;
5244
+ /** Number of dimensions the index has been configured for. */
5245
+ dimensions: number;
5246
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5247
+ processedUpToDatetime: number;
5248
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5249
+ processedUpToMutation: number;
5250
+ }
5230
5251
  /**
5231
5252
  * Represents a single vector value set along with its associated metadata.
5232
5253
  */
@@ -5237,7 +5258,7 @@ interface VectorizeVector {
5237
5258
  values: VectorFloatArray | number[];
5238
5259
  /** The namespace this vector belongs to. */
5239
5260
  namespace?: string;
5240
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5261
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5241
5262
  metadata?: Record<string, VectorizeVectorMetadata>;
5242
5263
  }
5243
5264
  /**
@@ -5249,7 +5270,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5249
5270
  score: number;
5250
5271
  };
5251
5272
  /**
5252
- * A set of vector {@link VectorizeMatch} for a particular query.
5273
+ * A set of matching {@link VectorizeMatch} for a particular query.
5253
5274
  */
5254
5275
  interface VectorizeMatches {
5255
5276
  matches: VectorizeMatch[];
@@ -5258,6 +5279,9 @@ interface VectorizeMatches {
5258
5279
  /**
5259
5280
  * Results of an operation that performed a mutation on a set of vectors.
5260
5281
  * Here, `ids` is a list of vectors that were successfully processed.
5282
+ *
5283
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5284
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5261
5285
  */
5262
5286
  interface VectorizeVectorMutation {
5263
5287
  /* List of ids of vectors that were successfully processed. */
@@ -5266,14 +5290,19 @@ interface VectorizeVectorMutation {
5266
5290
  count: number;
5267
5291
  }
5268
5292
  /**
5269
- * Results of an operation that performed a mutation on a set of vectors
5270
- * with the v2 version of Vectorize.
5271
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5293
+ * Result type indicating a mutation on the Vectorize Index.
5294
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5272
5295
  */
5273
- interface VectorizeVectorMutationV2 {
5274
- /* The identifier for the last mutation processed by Vectorize. */
5296
+ interface VectorizeAsyncMutation {
5297
+ /** The unique identifier for the async mutation operation containing the changeset. */
5275
5298
  mutationId: string;
5276
5299
  }
5300
+ /**
5301
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5302
+ *
5303
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5304
+ * See {@link Vectorize} for its new implementation.
5305
+ */
5277
5306
  declare abstract class VectorizeIndex {
5278
5307
  /**
5279
5308
  * Get information about the currently bound index.
@@ -5315,6 +5344,52 @@ declare abstract class VectorizeIndex {
5315
5344
  */
5316
5345
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5317
5346
  }
5347
+ /**
5348
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5349
+ *
5350
+ * Mutations in this version are async, returning a mutation id.
5351
+ */
5352
+ declare abstract class Vectorize {
5353
+ /**
5354
+ * Get information about the currently bound index.
5355
+ * @returns A promise that resolves with information about the current index.
5356
+ */
5357
+ public describe(): Promise<VectorizeIndexInfo>;
5358
+ /**
5359
+ * Use the provided vector to perform a similarity search across the index.
5360
+ * @param vector Input vector that will be used to drive the similarity search.
5361
+ * @param options Configuration options to massage the returned data.
5362
+ * @returns A promise that resolves with matched and scored vectors.
5363
+ */
5364
+ public query(
5365
+ vector: VectorFloatArray | number[],
5366
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5367
+ ): Promise<VectorizeMatches>;
5368
+ /**
5369
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5370
+ * @param vectors List of vectors that will be inserted.
5371
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5372
+ */
5373
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5374
+ /**
5375
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5376
+ * @param vectors List of vectors that will be upserted.
5377
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5378
+ */
5379
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5380
+ /**
5381
+ * Delete a list of vectors with a matching id.
5382
+ * @param ids List of vector ids that should be deleted.
5383
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5384
+ */
5385
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5386
+ /**
5387
+ * Get a list of vectors with a matching id.
5388
+ * @param ids List of vector ids that should be returned.
5389
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5390
+ */
5391
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5392
+ }
5318
5393
  /**
5319
5394
  * The interface for "version_metadata" binding
5320
5395
  * providing metadata about the Worker Version using this binding.
@@ -1643,12 +1643,6 @@ export declare class Request<
1643
1643
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1644
1644
  */
1645
1645
  get keepalive(): boolean;
1646
- /**
1647
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1648
- *
1649
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1650
- */
1651
- get cache(): string | undefined;
1652
1646
  }
1653
1647
  export interface RequestInit<Cf = CfProperties> {
1654
1648
  /* A string to set request's method. */
@@ -1661,8 +1655,6 @@ export interface RequestInit<Cf = CfProperties> {
1661
1655
  redirect?: string;
1662
1656
  fetcher?: Fetcher | null;
1663
1657
  cf?: Cf;
1664
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1665
- cache?: string;
1666
1658
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1667
1659
  integrity?: string;
1668
1660
  /* An AbortSignal to set request's signal. */
@@ -3639,6 +3631,7 @@ export type BaseAiSpeechRecognitionModels =
3639
3631
  export type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3640
3632
  export type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3641
3633
  export type BaseAiTextGenerationModels =
3634
+ | "@cf/meta/llama-3.1-8b-instruct"
3642
3635
  | "@cf/meta/llama-3-8b-instruct"
3643
3636
  | "@cf/meta/llama-3-8b-instruct-awq"
3644
3637
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4747,7 +4740,7 @@ export declare abstract class D1PreparedStatement {
4747
4740
  bind(...values: unknown[]): D1PreparedStatement;
4748
4741
  first<T = unknown>(colName: string): Promise<T | null>;
4749
4742
  first<T = Record<string, unknown>>(): Promise<T | null>;
4750
- run(): Promise<D1Response>;
4743
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4751
4744
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4752
4745
  raw<T = unknown[]>(options: {
4753
4746
  columnNames: true;
@@ -5154,11 +5147,23 @@ export type VectorizeVectorMetadataFilter = {
5154
5147
  * Distance metrics determine how other "similar" vectors are determined.
5155
5148
  */
5156
5149
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5157
- export interface VectorizeQueryOptions {
5150
+ /**
5151
+ * Metadata return levels for a Vectorize query.
5152
+ *
5153
+ * Default to "none".
5154
+ *
5155
+ * @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.
5156
+ * @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).
5157
+ * @property none No indexed metadata will be returned.
5158
+ */
5159
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5160
+ export interface VectorizeQueryOptions<
5161
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5162
+ > {
5158
5163
  topK?: number;
5159
5164
  namespace?: string;
5160
5165
  returnValues?: boolean;
5161
- returnMetadata?: boolean;
5166
+ returnMetadata?: MetadataReturn;
5162
5167
  filter?: VectorizeVectorMetadataFilter;
5163
5168
  }
5164
5169
  /**
@@ -5174,6 +5179,9 @@ export type VectorizeIndexConfig =
5174
5179
  };
5175
5180
  /**
5176
5181
  * Metadata about an existing index.
5182
+ *
5183
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5184
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5177
5185
  */
5178
5186
  export interface VectorizeIndexDetails {
5179
5187
  /** The unique ID of the index */
@@ -5187,6 +5195,19 @@ export interface VectorizeIndexDetails {
5187
5195
  /** The number of records containing vectors within the index. */
5188
5196
  vectorsCount: number;
5189
5197
  }
5198
+ /**
5199
+ * Metadata about an existing index.
5200
+ */
5201
+ export interface VectorizeIndexInfo {
5202
+ /** The number of records containing vectors within the index. */
5203
+ vectorsCount: number;
5204
+ /** Number of dimensions the index has been configured for. */
5205
+ dimensions: number;
5206
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5207
+ processedUpToDatetime: number;
5208
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5209
+ processedUpToMutation: number;
5210
+ }
5190
5211
  /**
5191
5212
  * Represents a single vector value set along with its associated metadata.
5192
5213
  */
@@ -5197,7 +5218,7 @@ export interface VectorizeVector {
5197
5218
  values: VectorFloatArray | number[];
5198
5219
  /** The namespace this vector belongs to. */
5199
5220
  namespace?: string;
5200
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5221
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5201
5222
  metadata?: Record<string, VectorizeVectorMetadata>;
5202
5223
  }
5203
5224
  /**
@@ -5209,7 +5230,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5209
5230
  score: number;
5210
5231
  };
5211
5232
  /**
5212
- * A set of vector {@link VectorizeMatch} for a particular query.
5233
+ * A set of matching {@link VectorizeMatch} for a particular query.
5213
5234
  */
5214
5235
  export interface VectorizeMatches {
5215
5236
  matches: VectorizeMatch[];
@@ -5218,6 +5239,9 @@ export interface VectorizeMatches {
5218
5239
  /**
5219
5240
  * Results of an operation that performed a mutation on a set of vectors.
5220
5241
  * Here, `ids` is a list of vectors that were successfully processed.
5242
+ *
5243
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5244
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5221
5245
  */
5222
5246
  export interface VectorizeVectorMutation {
5223
5247
  /* List of ids of vectors that were successfully processed. */
@@ -5226,14 +5250,19 @@ export interface VectorizeVectorMutation {
5226
5250
  count: number;
5227
5251
  }
5228
5252
  /**
5229
- * Results of an operation that performed a mutation on a set of vectors
5230
- * with the v2 version of Vectorize.
5231
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5253
+ * Result type indicating a mutation on the Vectorize Index.
5254
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5232
5255
  */
5233
- export interface VectorizeVectorMutationV2 {
5234
- /* The identifier for the last mutation processed by Vectorize. */
5256
+ export interface VectorizeAsyncMutation {
5257
+ /** The unique identifier for the async mutation operation containing the changeset. */
5235
5258
  mutationId: string;
5236
5259
  }
5260
+ /**
5261
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5262
+ *
5263
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5264
+ * See {@link Vectorize} for its new implementation.
5265
+ */
5237
5266
  export declare abstract class VectorizeIndex {
5238
5267
  /**
5239
5268
  * Get information about the currently bound index.
@@ -5275,6 +5304,52 @@ export declare abstract class VectorizeIndex {
5275
5304
  */
5276
5305
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5277
5306
  }
5307
+ /**
5308
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5309
+ *
5310
+ * Mutations in this version are async, returning a mutation id.
5311
+ */
5312
+ export declare abstract class Vectorize {
5313
+ /**
5314
+ * Get information about the currently bound index.
5315
+ * @returns A promise that resolves with information about the current index.
5316
+ */
5317
+ public describe(): Promise<VectorizeIndexInfo>;
5318
+ /**
5319
+ * Use the provided vector to perform a similarity search across the index.
5320
+ * @param vector Input vector that will be used to drive the similarity search.
5321
+ * @param options Configuration options to massage the returned data.
5322
+ * @returns A promise that resolves with matched and scored vectors.
5323
+ */
5324
+ public query(
5325
+ vector: VectorFloatArray | number[],
5326
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5327
+ ): Promise<VectorizeMatches>;
5328
+ /**
5329
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5330
+ * @param vectors List of vectors that will be inserted.
5331
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5332
+ */
5333
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5334
+ /**
5335
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5336
+ * @param vectors List of vectors that will be upserted.
5337
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5338
+ */
5339
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5340
+ /**
5341
+ * Delete a list of vectors with a matching id.
5342
+ * @param ids List of vector ids that should be deleted.
5343
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5344
+ */
5345
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5346
+ /**
5347
+ * Get a list of vectors with a matching id.
5348
+ * @param ids List of vector ids that should be returned.
5349
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5350
+ */
5351
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5352
+ }
5278
5353
  /**
5279
5354
  * The interface for "version_metadata" binding
5280
5355
  * providing metadata about the Worker Version using this binding.