@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.
@@ -1609,12 +1609,6 @@ export declare class Request<
1609
1609
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1610
1610
  */
1611
1611
  get keepalive(): boolean;
1612
- /**
1613
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1614
- *
1615
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1616
- */
1617
- get cache(): string | undefined;
1618
1612
  }
1619
1613
  export interface RequestInit<Cf = CfProperties> {
1620
1614
  /* A string to set request's method. */
@@ -1627,8 +1621,6 @@ export interface RequestInit<Cf = CfProperties> {
1627
1621
  redirect?: string;
1628
1622
  fetcher?: Fetcher | null;
1629
1623
  cf?: Cf;
1630
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1631
- cache?: string;
1632
1624
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1633
1625
  integrity?: string;
1634
1626
  /* An AbortSignal to set request's signal. */
@@ -3533,6 +3525,7 @@ export type BaseAiSpeechRecognitionModels =
3533
3525
  export type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3534
3526
  export type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3535
3527
  export type BaseAiTextGenerationModels =
3528
+ | "@cf/meta/llama-3.1-8b-instruct"
3536
3529
  | "@cf/meta/llama-3-8b-instruct"
3537
3530
  | "@cf/meta/llama-3-8b-instruct-awq"
3538
3531
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4641,7 +4634,7 @@ export declare abstract class D1PreparedStatement {
4641
4634
  bind(...values: unknown[]): D1PreparedStatement;
4642
4635
  first<T = unknown>(colName: string): Promise<T | null>;
4643
4636
  first<T = Record<string, unknown>>(): Promise<T | null>;
4644
- run(): Promise<D1Response>;
4637
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4645
4638
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4646
4639
  raw<T = unknown[]>(options: {
4647
4640
  columnNames: true;
@@ -5048,11 +5041,23 @@ export type VectorizeVectorMetadataFilter = {
5048
5041
  * Distance metrics determine how other "similar" vectors are determined.
5049
5042
  */
5050
5043
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5051
- export interface VectorizeQueryOptions {
5044
+ /**
5045
+ * Metadata return levels for a Vectorize query.
5046
+ *
5047
+ * Default to "none".
5048
+ *
5049
+ * @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.
5050
+ * @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).
5051
+ * @property none No indexed metadata will be returned.
5052
+ */
5053
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5054
+ export interface VectorizeQueryOptions<
5055
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5056
+ > {
5052
5057
  topK?: number;
5053
5058
  namespace?: string;
5054
5059
  returnValues?: boolean;
5055
- returnMetadata?: boolean;
5060
+ returnMetadata?: MetadataReturn;
5056
5061
  filter?: VectorizeVectorMetadataFilter;
5057
5062
  }
5058
5063
  /**
@@ -5068,6 +5073,9 @@ export type VectorizeIndexConfig =
5068
5073
  };
5069
5074
  /**
5070
5075
  * Metadata about an existing index.
5076
+ *
5077
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5078
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5071
5079
  */
5072
5080
  export interface VectorizeIndexDetails {
5073
5081
  /** The unique ID of the index */
@@ -5081,6 +5089,19 @@ export interface VectorizeIndexDetails {
5081
5089
  /** The number of records containing vectors within the index. */
5082
5090
  vectorsCount: number;
5083
5091
  }
5092
+ /**
5093
+ * Metadata about an existing index.
5094
+ */
5095
+ export interface VectorizeIndexInfo {
5096
+ /** The number of records containing vectors within the index. */
5097
+ vectorsCount: number;
5098
+ /** Number of dimensions the index has been configured for. */
5099
+ dimensions: number;
5100
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5101
+ processedUpToDatetime: number;
5102
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5103
+ processedUpToMutation: number;
5104
+ }
5084
5105
  /**
5085
5106
  * Represents a single vector value set along with its associated metadata.
5086
5107
  */
@@ -5091,7 +5112,7 @@ export interface VectorizeVector {
5091
5112
  values: VectorFloatArray | number[];
5092
5113
  /** The namespace this vector belongs to. */
5093
5114
  namespace?: string;
5094
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5115
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5095
5116
  metadata?: Record<string, VectorizeVectorMetadata>;
5096
5117
  }
5097
5118
  /**
@@ -5103,7 +5124,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5103
5124
  score: number;
5104
5125
  };
5105
5126
  /**
5106
- * A set of vector {@link VectorizeMatch} for a particular query.
5127
+ * A set of matching {@link VectorizeMatch} for a particular query.
5107
5128
  */
5108
5129
  export interface VectorizeMatches {
5109
5130
  matches: VectorizeMatch[];
@@ -5112,6 +5133,9 @@ export interface VectorizeMatches {
5112
5133
  /**
5113
5134
  * Results of an operation that performed a mutation on a set of vectors.
5114
5135
  * Here, `ids` is a list of vectors that were successfully processed.
5136
+ *
5137
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5138
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5115
5139
  */
5116
5140
  export interface VectorizeVectorMutation {
5117
5141
  /* List of ids of vectors that were successfully processed. */
@@ -5120,14 +5144,19 @@ export interface VectorizeVectorMutation {
5120
5144
  count: number;
5121
5145
  }
5122
5146
  /**
5123
- * Results of an operation that performed a mutation on a set of vectors
5124
- * with the v2 version of Vectorize.
5125
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5147
+ * Result type indicating a mutation on the Vectorize Index.
5148
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5126
5149
  */
5127
- export interface VectorizeVectorMutationV2 {
5128
- /* The identifier for the last mutation processed by Vectorize. */
5150
+ export interface VectorizeAsyncMutation {
5151
+ /** The unique identifier for the async mutation operation containing the changeset. */
5129
5152
  mutationId: string;
5130
5153
  }
5154
+ /**
5155
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5156
+ *
5157
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5158
+ * See {@link Vectorize} for its new implementation.
5159
+ */
5131
5160
  export declare abstract class VectorizeIndex {
5132
5161
  /**
5133
5162
  * Get information about the currently bound index.
@@ -5169,6 +5198,52 @@ export declare abstract class VectorizeIndex {
5169
5198
  */
5170
5199
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5171
5200
  }
5201
+ /**
5202
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5203
+ *
5204
+ * Mutations in this version are async, returning a mutation id.
5205
+ */
5206
+ export declare abstract class Vectorize {
5207
+ /**
5208
+ * Get information about the currently bound index.
5209
+ * @returns A promise that resolves with information about the current index.
5210
+ */
5211
+ public describe(): Promise<VectorizeIndexInfo>;
5212
+ /**
5213
+ * Use the provided vector to perform a similarity search across the index.
5214
+ * @param vector Input vector that will be used to drive the similarity search.
5215
+ * @param options Configuration options to massage the returned data.
5216
+ * @returns A promise that resolves with matched and scored vectors.
5217
+ */
5218
+ public query(
5219
+ vector: VectorFloatArray | number[],
5220
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5221
+ ): Promise<VectorizeMatches>;
5222
+ /**
5223
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5224
+ * @param vectors List of vectors that will be inserted.
5225
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5226
+ */
5227
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5228
+ /**
5229
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5230
+ * @param vectors List of vectors that will be upserted.
5231
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5232
+ */
5233
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5234
+ /**
5235
+ * Delete a list of vectors with a matching id.
5236
+ * @param ids List of vector ids that should be deleted.
5237
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5238
+ */
5239
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5240
+ /**
5241
+ * Get a list of vectors with a matching id.
5242
+ * @param ids List of vector ids that should be returned.
5243
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5244
+ */
5245
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5246
+ }
5172
5247
  /**
5173
5248
  * The interface for "version_metadata" binding
5174
5249
  * providing metadata about the Worker Version using this binding.
@@ -1621,12 +1621,6 @@ declare class Request<
1621
1621
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1622
1622
  */
1623
1623
  get keepalive(): boolean;
1624
- /**
1625
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1626
- *
1627
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1628
- */
1629
- get cache(): string | undefined;
1630
1624
  }
1631
1625
  interface RequestInit<Cf = CfProperties> {
1632
1626
  /* A string to set request's method. */
@@ -1639,8 +1633,6 @@ interface RequestInit<Cf = CfProperties> {
1639
1633
  redirect?: string;
1640
1634
  fetcher?: Fetcher | null;
1641
1635
  cf?: Cf;
1642
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1643
- cache?: string;
1644
1636
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1645
1637
  integrity?: string;
1646
1638
  /* An AbortSignal to set request's signal. */
@@ -3547,6 +3539,7 @@ type BaseAiSpeechRecognitionModels =
3547
3539
  type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3548
3540
  type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3549
3541
  type BaseAiTextGenerationModels =
3542
+ | "@cf/meta/llama-3.1-8b-instruct"
3550
3543
  | "@cf/meta/llama-3-8b-instruct"
3551
3544
  | "@cf/meta/llama-3-8b-instruct-awq"
3552
3545
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4643,7 +4636,7 @@ declare abstract class D1PreparedStatement {
4643
4636
  bind(...values: unknown[]): D1PreparedStatement;
4644
4637
  first<T = unknown>(colName: string): Promise<T | null>;
4645
4638
  first<T = Record<string, unknown>>(): Promise<T | null>;
4646
- run(): Promise<D1Response>;
4639
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4647
4640
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4648
4641
  raw<T = unknown[]>(options: {
4649
4642
  columnNames: true;
@@ -5112,11 +5105,23 @@ type VectorizeVectorMetadataFilter = {
5112
5105
  * Distance metrics determine how other "similar" vectors are determined.
5113
5106
  */
5114
5107
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5115
- interface VectorizeQueryOptions {
5108
+ /**
5109
+ * Metadata return levels for a Vectorize query.
5110
+ *
5111
+ * Default to "none".
5112
+ *
5113
+ * @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.
5114
+ * @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).
5115
+ * @property none No indexed metadata will be returned.
5116
+ */
5117
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5118
+ interface VectorizeQueryOptions<
5119
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5120
+ > {
5116
5121
  topK?: number;
5117
5122
  namespace?: string;
5118
5123
  returnValues?: boolean;
5119
- returnMetadata?: boolean;
5124
+ returnMetadata?: MetadataReturn;
5120
5125
  filter?: VectorizeVectorMetadataFilter;
5121
5126
  }
5122
5127
  /**
@@ -5132,6 +5137,9 @@ type VectorizeIndexConfig =
5132
5137
  };
5133
5138
  /**
5134
5139
  * Metadata about an existing index.
5140
+ *
5141
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5142
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5135
5143
  */
5136
5144
  interface VectorizeIndexDetails {
5137
5145
  /** The unique ID of the index */
@@ -5145,6 +5153,19 @@ interface VectorizeIndexDetails {
5145
5153
  /** The number of records containing vectors within the index. */
5146
5154
  vectorsCount: number;
5147
5155
  }
5156
+ /**
5157
+ * Metadata about an existing index.
5158
+ */
5159
+ interface VectorizeIndexInfo {
5160
+ /** The number of records containing vectors within the index. */
5161
+ vectorsCount: number;
5162
+ /** Number of dimensions the index has been configured for. */
5163
+ dimensions: number;
5164
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5165
+ processedUpToDatetime: number;
5166
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5167
+ processedUpToMutation: number;
5168
+ }
5148
5169
  /**
5149
5170
  * Represents a single vector value set along with its associated metadata.
5150
5171
  */
@@ -5155,7 +5176,7 @@ interface VectorizeVector {
5155
5176
  values: VectorFloatArray | number[];
5156
5177
  /** The namespace this vector belongs to. */
5157
5178
  namespace?: string;
5158
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5179
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5159
5180
  metadata?: Record<string, VectorizeVectorMetadata>;
5160
5181
  }
5161
5182
  /**
@@ -5167,7 +5188,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5167
5188
  score: number;
5168
5189
  };
5169
5190
  /**
5170
- * A set of vector {@link VectorizeMatch} for a particular query.
5191
+ * A set of matching {@link VectorizeMatch} for a particular query.
5171
5192
  */
5172
5193
  interface VectorizeMatches {
5173
5194
  matches: VectorizeMatch[];
@@ -5176,6 +5197,9 @@ interface VectorizeMatches {
5176
5197
  /**
5177
5198
  * Results of an operation that performed a mutation on a set of vectors.
5178
5199
  * Here, `ids` is a list of vectors that were successfully processed.
5200
+ *
5201
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5202
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5179
5203
  */
5180
5204
  interface VectorizeVectorMutation {
5181
5205
  /* List of ids of vectors that were successfully processed. */
@@ -5184,14 +5208,19 @@ interface VectorizeVectorMutation {
5184
5208
  count: number;
5185
5209
  }
5186
5210
  /**
5187
- * Results of an operation that performed a mutation on a set of vectors
5188
- * with the v2 version of Vectorize.
5189
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5211
+ * Result type indicating a mutation on the Vectorize Index.
5212
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5190
5213
  */
5191
- interface VectorizeVectorMutationV2 {
5192
- /* The identifier for the last mutation processed by Vectorize. */
5214
+ interface VectorizeAsyncMutation {
5215
+ /** The unique identifier for the async mutation operation containing the changeset. */
5193
5216
  mutationId: string;
5194
5217
  }
5218
+ /**
5219
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5220
+ *
5221
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5222
+ * See {@link Vectorize} for its new implementation.
5223
+ */
5195
5224
  declare abstract class VectorizeIndex {
5196
5225
  /**
5197
5226
  * Get information about the currently bound index.
@@ -5233,6 +5262,52 @@ declare abstract class VectorizeIndex {
5233
5262
  */
5234
5263
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5235
5264
  }
5265
+ /**
5266
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5267
+ *
5268
+ * Mutations in this version are async, returning a mutation id.
5269
+ */
5270
+ declare abstract class Vectorize {
5271
+ /**
5272
+ * Get information about the currently bound index.
5273
+ * @returns A promise that resolves with information about the current index.
5274
+ */
5275
+ public describe(): Promise<VectorizeIndexInfo>;
5276
+ /**
5277
+ * Use the provided vector to perform a similarity search across the index.
5278
+ * @param vector Input vector that will be used to drive the similarity search.
5279
+ * @param options Configuration options to massage the returned data.
5280
+ * @returns A promise that resolves with matched and scored vectors.
5281
+ */
5282
+ public query(
5283
+ vector: VectorFloatArray | number[],
5284
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5285
+ ): Promise<VectorizeMatches>;
5286
+ /**
5287
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5288
+ * @param vectors List of vectors that will be inserted.
5289
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5290
+ */
5291
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5292
+ /**
5293
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5294
+ * @param vectors List of vectors that will be upserted.
5295
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5296
+ */
5297
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5298
+ /**
5299
+ * Delete a list of vectors with a matching id.
5300
+ * @param ids List of vector ids that should be deleted.
5301
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5302
+ */
5303
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5304
+ /**
5305
+ * Get a list of vectors with a matching id.
5306
+ * @param ids List of vector ids that should be returned.
5307
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5308
+ */
5309
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5310
+ }
5236
5311
  /**
5237
5312
  * The interface for "version_metadata" binding
5238
5313
  * providing metadata about the Worker Version using this binding.
@@ -1626,12 +1626,6 @@ export declare class Request<
1626
1626
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1627
1627
  */
1628
1628
  get keepalive(): boolean;
1629
- /**
1630
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1631
- *
1632
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1633
- */
1634
- get cache(): string | undefined;
1635
1629
  }
1636
1630
  export interface RequestInit<Cf = CfProperties> {
1637
1631
  /* A string to set request's method. */
@@ -1644,8 +1638,6 @@ export interface RequestInit<Cf = CfProperties> {
1644
1638
  redirect?: string;
1645
1639
  fetcher?: Fetcher | null;
1646
1640
  cf?: Cf;
1647
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1648
- cache?: string;
1649
1641
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1650
1642
  integrity?: string;
1651
1643
  /* An AbortSignal to set request's signal. */
@@ -3557,6 +3549,7 @@ export type BaseAiSpeechRecognitionModels =
3557
3549
  export type BaseAiImageClassificationModels = "@cf/microsoft/resnet-50";
3558
3550
  export type BaseAiObjectDetectionModels = "@cf/facebook/detr-resnet-50";
3559
3551
  export type BaseAiTextGenerationModels =
3552
+ | "@cf/meta/llama-3.1-8b-instruct"
3560
3553
  | "@cf/meta/llama-3-8b-instruct"
3561
3554
  | "@cf/meta/llama-3-8b-instruct-awq"
3562
3555
  | "@cf/meta/llama-2-7b-chat-int8"
@@ -4665,7 +4658,7 @@ export declare abstract class D1PreparedStatement {
4665
4658
  bind(...values: unknown[]): D1PreparedStatement;
4666
4659
  first<T = unknown>(colName: string): Promise<T | null>;
4667
4660
  first<T = Record<string, unknown>>(): Promise<T | null>;
4668
- run(): Promise<D1Response>;
4661
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4669
4662
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4670
4663
  raw<T = unknown[]>(options: {
4671
4664
  columnNames: true;
@@ -5072,11 +5065,23 @@ export type VectorizeVectorMetadataFilter = {
5072
5065
  * Distance metrics determine how other "similar" vectors are determined.
5073
5066
  */
5074
5067
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5075
- export interface VectorizeQueryOptions {
5068
+ /**
5069
+ * Metadata return levels for a Vectorize query.
5070
+ *
5071
+ * Default to "none".
5072
+ *
5073
+ * @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.
5074
+ * @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).
5075
+ * @property none No indexed metadata will be returned.
5076
+ */
5077
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5078
+ export interface VectorizeQueryOptions<
5079
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5080
+ > {
5076
5081
  topK?: number;
5077
5082
  namespace?: string;
5078
5083
  returnValues?: boolean;
5079
- returnMetadata?: boolean;
5084
+ returnMetadata?: MetadataReturn;
5080
5085
  filter?: VectorizeVectorMetadataFilter;
5081
5086
  }
5082
5087
  /**
@@ -5092,6 +5097,9 @@ export type VectorizeIndexConfig =
5092
5097
  };
5093
5098
  /**
5094
5099
  * Metadata about an existing index.
5100
+ *
5101
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5102
+ * See {@link VectorizeIndexInfo} for its post-beta equivalent.
5095
5103
  */
5096
5104
  export interface VectorizeIndexDetails {
5097
5105
  /** The unique ID of the index */
@@ -5105,6 +5113,19 @@ export interface VectorizeIndexDetails {
5105
5113
  /** The number of records containing vectors within the index. */
5106
5114
  vectorsCount: number;
5107
5115
  }
5116
+ /**
5117
+ * Metadata about an existing index.
5118
+ */
5119
+ export interface VectorizeIndexInfo {
5120
+ /** The number of records containing vectors within the index. */
5121
+ vectorsCount: number;
5122
+ /** Number of dimensions the index has been configured for. */
5123
+ dimensions: number;
5124
+ /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
5125
+ processedUpToDatetime: number;
5126
+ /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
5127
+ processedUpToMutation: number;
5128
+ }
5108
5129
  /**
5109
5130
  * Represents a single vector value set along with its associated metadata.
5110
5131
  */
@@ -5115,7 +5136,7 @@ export interface VectorizeVector {
5115
5136
  values: VectorFloatArray | number[];
5116
5137
  /** The namespace this vector belongs to. */
5117
5138
  namespace?: string;
5118
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5139
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5119
5140
  metadata?: Record<string, VectorizeVectorMetadata>;
5120
5141
  }
5121
5142
  /**
@@ -5127,7 +5148,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5127
5148
  score: number;
5128
5149
  };
5129
5150
  /**
5130
- * A set of vector {@link VectorizeMatch} for a particular query.
5151
+ * A set of matching {@link VectorizeMatch} for a particular query.
5131
5152
  */
5132
5153
  export interface VectorizeMatches {
5133
5154
  matches: VectorizeMatch[];
@@ -5136,6 +5157,9 @@ export interface VectorizeMatches {
5136
5157
  /**
5137
5158
  * Results of an operation that performed a mutation on a set of vectors.
5138
5159
  * Here, `ids` is a list of vectors that were successfully processed.
5160
+ *
5161
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5162
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5139
5163
  */
5140
5164
  export interface VectorizeVectorMutation {
5141
5165
  /* List of ids of vectors that were successfully processed. */
@@ -5144,14 +5168,19 @@ export interface VectorizeVectorMutation {
5144
5168
  count: number;
5145
5169
  }
5146
5170
  /**
5147
- * Results of an operation that performed a mutation on a set of vectors
5148
- * with the v2 version of Vectorize.
5149
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5171
+ * Result type indicating a mutation on the Vectorize Index.
5172
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5150
5173
  */
5151
- export interface VectorizeVectorMutationV2 {
5152
- /* The identifier for the last mutation processed by Vectorize. */
5174
+ export interface VectorizeAsyncMutation {
5175
+ /** The unique identifier for the async mutation operation containing the changeset. */
5153
5176
  mutationId: string;
5154
5177
  }
5178
+ /**
5179
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5180
+ *
5181
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5182
+ * See {@link Vectorize} for its new implementation.
5183
+ */
5155
5184
  export declare abstract class VectorizeIndex {
5156
5185
  /**
5157
5186
  * Get information about the currently bound index.
@@ -5193,6 +5222,52 @@ export declare abstract class VectorizeIndex {
5193
5222
  */
5194
5223
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5195
5224
  }
5225
+ /**
5226
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5227
+ *
5228
+ * Mutations in this version are async, returning a mutation id.
5229
+ */
5230
+ export declare abstract class Vectorize {
5231
+ /**
5232
+ * Get information about the currently bound index.
5233
+ * @returns A promise that resolves with information about the current index.
5234
+ */
5235
+ public describe(): Promise<VectorizeIndexInfo>;
5236
+ /**
5237
+ * Use the provided vector to perform a similarity search across the index.
5238
+ * @param vector Input vector that will be used to drive the similarity search.
5239
+ * @param options Configuration options to massage the returned data.
5240
+ * @returns A promise that resolves with matched and scored vectors.
5241
+ */
5242
+ public query(
5243
+ vector: VectorFloatArray | number[],
5244
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5245
+ ): Promise<VectorizeMatches>;
5246
+ /**
5247
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5248
+ * @param vectors List of vectors that will be inserted.
5249
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5250
+ */
5251
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5252
+ /**
5253
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5254
+ * @param vectors List of vectors that will be upserted.
5255
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5256
+ */
5257
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5258
+ /**
5259
+ * Delete a list of vectors with a matching id.
5260
+ * @param ids List of vector ids that should be deleted.
5261
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5262
+ */
5263
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5264
+ /**
5265
+ * Get a list of vectors with a matching id.
5266
+ * @param ids List of vector ids that should be returned.
5267
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5268
+ */
5269
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5270
+ }
5196
5271
  /**
5197
5272
  * The interface for "version_metadata" binding
5198
5273
  * providing metadata about the Worker Version using this binding.