deepinfra
Version:
Official API wrapper for DeepInfra
25 lines (24 loc) • 763 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Embeddings = void 0;
const base_1 = require("../../../lib/models/base");
class Embeddings extends base_1.BaseModel {
constructor(modelName, authToken, config) {
super(modelName, authToken, config);
}
async generate(body) {
try {
const response = await this.client.post(body);
const { data, status } = response;
if (status !== 200) {
throw new Error(`HTTP error! status: ${status}`);
}
return data;
}
catch (error) {
console.error("Error generating embeddings:", error);
throw error;
}
}
}
exports.Embeddings = Embeddings;