ravendb
Version:
RavenDB client for Node.js
31 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.VectorEmbeddingField = void 0;
const index_js_1 = require("../../../../Exceptions/index.js");
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") {
(0, index_js_1.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) {
(0, index_js_1.throwError)("InvalidOperationException", `Cannot quantize already quantized embeddings. Source VectorEmbeddingType is ${this.sourceQuantizationType}; however the destination is ${this.destinationQuantizationType}.`);
}
return this;
}
}
exports.VectorEmbeddingField = VectorEmbeddingField;
//# sourceMappingURL=VectorEmbeddingField.js.map