ravendb
Version:
RavenDB client for Node.js
27 lines • 1.4 kB
JavaScript
import { throwError } from "../../../../Exceptions/index.js";
export class VectorEmbeddingField {
fieldName;
sourceQuantizationType;
destinationQuantizationType;
isBase64Encoded;
embeddingsGenerationTaskIdentifier = "";
constructor(fieldName, sourceQuantizationType = "Single", isBase64Encoded = false) {
this.fieldName = fieldName;
this.sourceQuantizationType = sourceQuantizationType;
this.destinationQuantizationType = sourceQuantizationType;
this.isBase64Encoded = isBase64Encoded;
}
targetQuantization(targetEmbeddingQuantization) {
if (targetEmbeddingQuantization === "Text") {
throwError("InvalidOperationException", "Cannot quantize the embedding to Text. This option is only available for sourceQuantizationType.");
}
this.destinationQuantizationType = targetEmbeddingQuantization;
if ((this.sourceQuantizationType === "Int8" ||
this.sourceQuantizationType === "Binary") &&
this.destinationQuantizationType !== this.sourceQuantizationType) {
throwError("InvalidOperationException", `Cannot quantize already quantized embeddings. Source VectorEmbeddingType is ${this.sourceQuantizationType}; however the destination is ${this.destinationQuantizationType}.`);
}
return this;
}
}
//# sourceMappingURL=VectorEmbeddingField.js.map