@horribleprogram/sdk 0.1.6 → 0.1.8

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.
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,16 +17,32 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
21
31
  var index_exports = {};
22
32
  __export(index_exports, {
23
33
  Botcierge: () => Botcierge,
24
- query_intent: () => query_intent
34
+ CompanyEmbeddingManager: () => CompanyEmbeddingManager,
35
+ addCompany: () => addCompany,
36
+ closeConnection: () => closeConnection,
37
+ companyToText: () => companyToText,
38
+ parseCSV: () => parseCSV,
39
+ queryCompanies: () => queryCompanies,
40
+ query_intent: () => query_intent,
41
+ removeCompany: () => removeCompany,
42
+ seedCompanies: () => seedCompanies
25
43
  });
26
44
  module.exports = __toCommonJS(index_exports);
27
- var import_transformers = require("@xenova/transformers");
45
+ var import_transformers2 = require("@xenova/transformers");
28
46
 
29
47
  // src/intents.ts
30
48
  var INTENTS_TAXONOMY = {
@@ -163,6 +181,326 @@ var INTENTS_TAXONOMY = {
163
181
  }
164
182
  };
165
183
 
184
+ // src/companyEmbeddings.ts
185
+ var fs = __toESM(require("fs"), 1);
186
+ var import_mongodb = require("mongodb");
187
+ var import_transformers = require("@xenova/transformers");
188
+ function parseCSV(content) {
189
+ const lines = [];
190
+ let currentLine = "";
191
+ let insideQuote = false;
192
+ for (let i = 0; i < content.length; i++) {
193
+ const char = content[i];
194
+ const nextChar = content[i + 1];
195
+ if (char === '"') {
196
+ insideQuote = !insideQuote;
197
+ } else if (char === "\r" || char === "\n") {
198
+ if (!insideQuote) {
199
+ if (currentLine || i === 0 || content[i - 1] === "\n" || content[i - 1] === "\r") {
200
+ lines.push(currentLine);
201
+ currentLine = "";
202
+ }
203
+ if (char === "\r" && nextChar === "\n") {
204
+ i++;
205
+ }
206
+ } else {
207
+ currentLine += char;
208
+ }
209
+ } else {
210
+ currentLine += char;
211
+ }
212
+ }
213
+ if (currentLine) {
214
+ lines.push(currentLine);
215
+ }
216
+ if (lines.length === 0) return [];
217
+ const parseLine = (line) => {
218
+ const result = [];
219
+ let cell = "";
220
+ let inside = false;
221
+ for (let i = 0; i < line.length; i++) {
222
+ const char = line[i];
223
+ if (char === '"') {
224
+ if (inside && line[i + 1] === '"') {
225
+ cell += '"';
226
+ i++;
227
+ } else {
228
+ inside = !inside;
229
+ }
230
+ } else if (char === "," && !inside) {
231
+ result.push(cell.trim());
232
+ cell = "";
233
+ } else {
234
+ cell += char;
235
+ }
236
+ }
237
+ result.push(cell.trim());
238
+ return result;
239
+ };
240
+ const headers = parseLine(lines[0]);
241
+ const records = [];
242
+ for (let i = 1; i < lines.length; i++) {
243
+ const cells = parseLine(lines[i]);
244
+ if (cells.length === 1 && cells[0] === "") continue;
245
+ const record = {};
246
+ for (let j = 0; j < headers.length; j++) {
247
+ record[headers[j]] = cells[j] || "";
248
+ }
249
+ records.push(record);
250
+ }
251
+ return records;
252
+ }
253
+ function companyToText(company) {
254
+ const parts = [];
255
+ const keys = [
256
+ "company_name",
257
+ "website",
258
+ "short_description",
259
+ "product_description",
260
+ "mapped_function",
261
+ "mapped_industry",
262
+ "match_keywords",
263
+ "aliases",
264
+ "active",
265
+ "priority",
266
+ "source",
267
+ "zone"
268
+ ];
269
+ for (const key of keys) {
270
+ if (key in company) {
271
+ const val = String(company[key]).trim();
272
+ if (val) {
273
+ parts.push(`${key}: ${val}`);
274
+ }
275
+ }
276
+ }
277
+ for (const [key, value] of Object.entries(company)) {
278
+ if (keys.includes(key) || key === "_id" || key === "embedding") continue;
279
+ const val = String(value).trim();
280
+ if (val) {
281
+ parts.push(`${key}: ${val}`);
282
+ }
283
+ }
284
+ return parts.join(" | ");
285
+ }
286
+ function cosineSimilarity(v1, v2) {
287
+ let dotProduct = 0;
288
+ let norm1 = 0;
289
+ let norm2 = 0;
290
+ for (let i = 0; i < v1.length; i++) {
291
+ dotProduct += v1[i] * v2[i];
292
+ norm1 += v1[i] * v1[i];
293
+ norm2 += v2[i] * v2[i];
294
+ }
295
+ if (norm1 === 0 || norm2 === 0) return 0;
296
+ return dotProduct / (Math.sqrt(norm1) * Math.sqrt(norm2));
297
+ }
298
+ var CompanyEmbeddingManager = class {
299
+ client = null;
300
+ config;
301
+ extractorPromise = null;
302
+ constructor(config = {}) {
303
+ this.config = {
304
+ uri: config.uri || process.env.MONGODB_URI || "mongodb://localhost:27017",
305
+ dbName: config.dbName || process.env.MONGODB_DB_NAME || "distance_metrics",
306
+ collectionName: config.collectionName || "companies",
307
+ openAIApiKey: config.openAIApiKey || process.env.OPENAI_API_KEY || "",
308
+ preferOpenAI: config.preferOpenAI ?? !!(config.openAIApiKey || process.env.OPENAI_API_KEY),
309
+ mongoOptions: config.mongoOptions || {}
310
+ };
311
+ }
312
+ async getExtractor() {
313
+ if (!this.extractorPromise) {
314
+ this.extractorPromise = (async () => {
315
+ console.log("Loading local embedding model 'Xenova/all-MiniLM-L12-v2'...");
316
+ const extractor = await (0, import_transformers.pipeline)("feature-extraction", "Xenova/all-MiniLM-L12-v2");
317
+ console.log("Local embedding model loaded successfully.");
318
+ return extractor;
319
+ })();
320
+ }
321
+ return this.extractorPromise;
322
+ }
323
+ async connect() {
324
+ if (!this.client) {
325
+ this.client = new import_mongodb.MongoClient(this.config.uri, this.config.mongoOptions);
326
+ await this.client.connect();
327
+ }
328
+ return this.client;
329
+ }
330
+ async getCollection() {
331
+ const client = await this.connect();
332
+ return client.db(this.config.dbName).collection(this.config.collectionName);
333
+ }
334
+ async disconnect() {
335
+ if (this.client) {
336
+ await this.client.close();
337
+ this.client = null;
338
+ }
339
+ }
340
+ async getEmbedding(text) {
341
+ if (this.config.preferOpenAI && this.config.openAIApiKey) {
342
+ const embeddings = await this.getOpenAIBatchEmbeddings([text]);
343
+ return embeddings[0];
344
+ }
345
+ const extractor = await this.getExtractor();
346
+ const output = await extractor(text, { pooling: "mean", normalize: true });
347
+ return Array.from(output.data);
348
+ }
349
+ async getEmbeddings(texts) {
350
+ if (texts.length === 0) return [];
351
+ if (this.config.preferOpenAI && this.config.openAIApiKey) {
352
+ return this.getOpenAIBatchEmbeddings(texts);
353
+ }
354
+ const extractor = await this.getExtractor();
355
+ const output = await extractor(texts, { pooling: "mean", normalize: true });
356
+ const dim = output.dims[1];
357
+ const data = output.data;
358
+ const embeddings = [];
359
+ for (let i = 0; i < texts.length; i++) {
360
+ const startIndex = i * dim;
361
+ const vector = Array.from(data.subarray(startIndex, startIndex + dim));
362
+ embeddings.push(vector);
363
+ }
364
+ return embeddings;
365
+ }
366
+ async getOpenAIBatchEmbeddings(texts) {
367
+ const batchSize = 50;
368
+ const results = [];
369
+ for (let i = 0; i < texts.length; i += batchSize) {
370
+ const chunk = texts.slice(i, i + batchSize);
371
+ const response = await fetch("https://api.openai.com/v1/embeddings", {
372
+ method: "POST",
373
+ headers: {
374
+ "Content-Type": "application/json",
375
+ "Authorization": `Bearer ${this.config.openAIApiKey}`
376
+ },
377
+ body: JSON.stringify({
378
+ input: chunk,
379
+ model: "text-embedding-3-small"
380
+ })
381
+ });
382
+ if (!response.ok) {
383
+ const errorText = await response.text();
384
+ throw new Error(`OpenAI API error: ${response.status} - ${errorText}`);
385
+ }
386
+ const json = await response.json();
387
+ results.push(...json.data.map((item) => item.embedding));
388
+ }
389
+ return results;
390
+ }
391
+ async addCompany(company) {
392
+ const col = await this.getCollection();
393
+ let active = company.active;
394
+ if (typeof active === "string") {
395
+ const activeStr = active.toLowerCase().trim();
396
+ active = activeStr === "true" || activeStr === "yes" || activeStr === "1";
397
+ }
398
+ const cleanCompany = {
399
+ ...company,
400
+ active: !!active
401
+ };
402
+ if (!cleanCompany.embedding) {
403
+ const text = companyToText(cleanCompany);
404
+ cleanCompany.embedding = await this.getEmbedding(text);
405
+ }
406
+ await col.updateOne(
407
+ { company_name: cleanCompany.company_name },
408
+ { $set: cleanCompany },
409
+ { upsert: true }
410
+ );
411
+ }
412
+ async removeCompany(companyName) {
413
+ const col = await this.getCollection();
414
+ const result = await col.deleteOne({
415
+ company_name: { $regex: new RegExp(`^${this.escapeRegExp(companyName)}$`, "i") }
416
+ });
417
+ return (result.deletedCount ?? 0) > 0;
418
+ }
419
+ async queryCompanies(prompt, limit = 10) {
420
+ const col = await this.getCollection();
421
+ const queryVector = await this.getEmbedding(prompt);
422
+ const allDocs = await col.find({}).toArray();
423
+ const results = allDocs.filter((doc) => doc.embedding && Array.isArray(doc.embedding)).map((doc) => {
424
+ const similarity = cosineSimilarity(queryVector, doc.embedding);
425
+ return {
426
+ ...doc,
427
+ similarity
428
+ };
429
+ });
430
+ results.sort((a, b) => b.similarity - a.similarity);
431
+ return results.slice(0, limit);
432
+ }
433
+ async seedFromCSV(csvPath) {
434
+ const csvContent = fs.readFileSync(csvPath, "utf8");
435
+ const records = parseCSV(csvContent);
436
+ if (records.length === 0) return 0;
437
+ const companies = records.map((rec) => {
438
+ const activeStr = String(rec.active).toLowerCase().trim();
439
+ const active = activeStr === "true" || activeStr === "yes" || activeStr === "1";
440
+ return {
441
+ company_name: rec.company_name || "",
442
+ website: rec.website || "",
443
+ short_description: rec.short_description || "",
444
+ product_description: rec.product_description || "",
445
+ mapped_function: rec.mapped_function || "",
446
+ mapped_industry: rec.mapped_industry || "",
447
+ match_keywords: rec.match_keywords || "",
448
+ aliases: rec.aliases || "",
449
+ active,
450
+ priority: rec.priority || "",
451
+ source: rec.source || "",
452
+ zone: rec.zone || ""
453
+ };
454
+ }).filter((c) => c.company_name);
455
+ const texts = companies.map((c) => companyToText(c));
456
+ console.log(`Generating embeddings for ${companies.length} companies...`);
457
+ const embeddings = await this.getEmbeddings(texts);
458
+ for (let i = 0; i < companies.length; i++) {
459
+ companies[i].embedding = embeddings[i];
460
+ }
461
+ const col = await this.getCollection();
462
+ await col.deleteMany({});
463
+ const batchSize = 100;
464
+ for (let i = 0; i < companies.length; i += batchSize) {
465
+ const batch = companies.slice(i, i + batchSize);
466
+ await col.insertMany(batch);
467
+ }
468
+ return companies.length;
469
+ }
470
+ escapeRegExp(string) {
471
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
472
+ }
473
+ };
474
+ var defaultManager = null;
475
+ function getDefaultManager(config) {
476
+ if (!defaultManager || config) {
477
+ defaultManager = new CompanyEmbeddingManager(config);
478
+ }
479
+ return defaultManager;
480
+ }
481
+ async function seedCompanies(csvPath, config) {
482
+ const manager = getDefaultManager(config);
483
+ return manager.seedFromCSV(csvPath);
484
+ }
485
+ async function addCompany(company, config) {
486
+ const manager = getDefaultManager(config);
487
+ return manager.addCompany(company);
488
+ }
489
+ async function removeCompany(companyName, config) {
490
+ const manager = getDefaultManager(config);
491
+ return manager.removeCompany(companyName);
492
+ }
493
+ async function queryCompanies(prompt, limit, config) {
494
+ const manager = getDefaultManager(config);
495
+ return manager.queryCompanies(prompt, limit);
496
+ }
497
+ async function closeConnection() {
498
+ if (defaultManager) {
499
+ await defaultManager.disconnect();
500
+ defaultManager = null;
501
+ }
502
+ }
503
+
166
504
  // src/index.ts
167
505
  var extractorPromise = null;
168
506
  function getExtractor() {
@@ -170,7 +508,7 @@ function getExtractor() {
170
508
  extractorPromise = (async () => {
171
509
  console.log("Loading local embedding model 'Xenova/all-MiniLM-L12-v2'...");
172
510
  console.log("Note: On first run, this will download the model files (approx. 120MB).");
173
- const extractor = await (0, import_transformers.pipeline)("feature-extraction", "Xenova/all-MiniLM-L12-v2");
511
+ const extractor = await (0, import_transformers2.pipeline)("feature-extraction", "Xenova/all-MiniLM-L12-v2");
174
512
  console.log("Local embedding model loaded successfully.");
175
513
  return extractor;
176
514
  })();
@@ -211,7 +549,7 @@ async function getTaxonomyEmbeddings() {
211
549
  })();
212
550
  return cachedTaxonomyEmbeddingsPromise;
213
551
  }
214
- function cosineSimilarity(v1, v2) {
552
+ function cosineSimilarity2(v1, v2) {
215
553
  let dotProduct = 0;
216
554
  let norm1 = 0;
217
555
  let norm2 = 0;
@@ -234,7 +572,7 @@ var Botcierge = class {
234
572
  let bestSim = -1;
235
573
  let bestItem = null;
236
574
  for (const item of taxEmbeddings) {
237
- const sim = cosineSimilarity(queryVector, item.vector);
575
+ const sim = cosineSimilarity2(queryVector, item.vector);
238
576
  if (sim > bestSim) {
239
577
  bestSim = sim;
240
578
  bestItem = item;
@@ -271,5 +609,13 @@ async function query_intent(utterance) {
271
609
  // Annotate the CommonJS export names for ESM import in node:
272
610
  0 && (module.exports = {
273
611
  Botcierge,
274
- query_intent
612
+ CompanyEmbeddingManager,
613
+ addCompany,
614
+ closeConnection,
615
+ companyToText,
616
+ parseCSV,
617
+ queryCompanies,
618
+ query_intent,
619
+ removeCompany,
620
+ seedCompanies
275
621
  });
package/dist/index.d.cts CHANGED
@@ -1,3 +1,63 @@
1
+ import { MongoClientOptions, MongoClient, Collection } from 'mongodb';
2
+
3
+ interface Company {
4
+ company_name: string;
5
+ website: string;
6
+ short_description: string;
7
+ product_description: string;
8
+ mapped_function: string;
9
+ mapped_industry: string;
10
+ match_keywords: string;
11
+ aliases: string;
12
+ active: boolean | string;
13
+ priority: string;
14
+ source: string;
15
+ zone: string;
16
+ embedding?: number[];
17
+ [key: string]: any;
18
+ }
19
+ interface MongoEmbeddingConfig {
20
+ uri?: string;
21
+ dbName?: string;
22
+ collectionName?: string;
23
+ openAIApiKey?: string;
24
+ preferOpenAI?: boolean;
25
+ mongoOptions?: MongoClientOptions;
26
+ }
27
+ declare function parseCSV(content: string): Record<string, string>[];
28
+ declare function companyToText(company: Partial<Company>): string;
29
+ declare class CompanyEmbeddingManager {
30
+ private client;
31
+ private config;
32
+ private extractorPromise;
33
+ constructor(config?: MongoEmbeddingConfig);
34
+ private getExtractor;
35
+ connect(): Promise<MongoClient>;
36
+ getCollection(): Promise<Collection<Company>>;
37
+ disconnect(): Promise<void>;
38
+ getEmbedding(text: string): Promise<number[]>;
39
+ getEmbeddings(texts: string[]): Promise<number[][]>;
40
+ private getOpenAIBatchEmbeddings;
41
+ addCompany(company: Omit<Company, 'embedding'> & {
42
+ embedding?: number[];
43
+ }): Promise<void>;
44
+ removeCompany(companyName: string): Promise<boolean>;
45
+ queryCompanies(prompt: string, limit?: number): Promise<(Company & {
46
+ similarity: number;
47
+ })[]>;
48
+ seedFromCSV(csvPath: string): Promise<number>;
49
+ private escapeRegExp;
50
+ }
51
+ declare function seedCompanies(csvPath: string, config?: MongoEmbeddingConfig): Promise<number>;
52
+ declare function addCompany(company: Omit<Company, 'embedding'> & {
53
+ embedding?: number[];
54
+ }, config?: MongoEmbeddingConfig): Promise<void>;
55
+ declare function removeCompany(companyName: string, config?: MongoEmbeddingConfig): Promise<boolean>;
56
+ declare function queryCompanies(prompt: string, limit?: number, config?: MongoEmbeddingConfig): Promise<(Company & {
57
+ similarity: number;
58
+ })[]>;
59
+ declare function closeConnection(): Promise<void>;
60
+
1
61
  interface IntentResult {
2
62
  domain: string;
3
63
  intent: string;
@@ -15,4 +75,4 @@ declare class Botcierge {
15
75
  */
16
76
  declare function query_intent(utterance: string): Promise<IntentResult>;
17
77
 
18
- export { Botcierge, type BotciergeConfig, type IntentResult, query_intent };
78
+ export { Botcierge, type BotciergeConfig, type Company, CompanyEmbeddingManager, type IntentResult, type MongoEmbeddingConfig, addCompany, closeConnection, companyToText, parseCSV, queryCompanies, query_intent, removeCompany, seedCompanies };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,63 @@
1
+ import { MongoClientOptions, MongoClient, Collection } from 'mongodb';
2
+
3
+ interface Company {
4
+ company_name: string;
5
+ website: string;
6
+ short_description: string;
7
+ product_description: string;
8
+ mapped_function: string;
9
+ mapped_industry: string;
10
+ match_keywords: string;
11
+ aliases: string;
12
+ active: boolean | string;
13
+ priority: string;
14
+ source: string;
15
+ zone: string;
16
+ embedding?: number[];
17
+ [key: string]: any;
18
+ }
19
+ interface MongoEmbeddingConfig {
20
+ uri?: string;
21
+ dbName?: string;
22
+ collectionName?: string;
23
+ openAIApiKey?: string;
24
+ preferOpenAI?: boolean;
25
+ mongoOptions?: MongoClientOptions;
26
+ }
27
+ declare function parseCSV(content: string): Record<string, string>[];
28
+ declare function companyToText(company: Partial<Company>): string;
29
+ declare class CompanyEmbeddingManager {
30
+ private client;
31
+ private config;
32
+ private extractorPromise;
33
+ constructor(config?: MongoEmbeddingConfig);
34
+ private getExtractor;
35
+ connect(): Promise<MongoClient>;
36
+ getCollection(): Promise<Collection<Company>>;
37
+ disconnect(): Promise<void>;
38
+ getEmbedding(text: string): Promise<number[]>;
39
+ getEmbeddings(texts: string[]): Promise<number[][]>;
40
+ private getOpenAIBatchEmbeddings;
41
+ addCompany(company: Omit<Company, 'embedding'> & {
42
+ embedding?: number[];
43
+ }): Promise<void>;
44
+ removeCompany(companyName: string): Promise<boolean>;
45
+ queryCompanies(prompt: string, limit?: number): Promise<(Company & {
46
+ similarity: number;
47
+ })[]>;
48
+ seedFromCSV(csvPath: string): Promise<number>;
49
+ private escapeRegExp;
50
+ }
51
+ declare function seedCompanies(csvPath: string, config?: MongoEmbeddingConfig): Promise<number>;
52
+ declare function addCompany(company: Omit<Company, 'embedding'> & {
53
+ embedding?: number[];
54
+ }, config?: MongoEmbeddingConfig): Promise<void>;
55
+ declare function removeCompany(companyName: string, config?: MongoEmbeddingConfig): Promise<boolean>;
56
+ declare function queryCompanies(prompt: string, limit?: number, config?: MongoEmbeddingConfig): Promise<(Company & {
57
+ similarity: number;
58
+ })[]>;
59
+ declare function closeConnection(): Promise<void>;
60
+
1
61
  interface IntentResult {
2
62
  domain: string;
3
63
  intent: string;
@@ -15,4 +75,4 @@ declare class Botcierge {
15
75
  */
16
76
  declare function query_intent(utterance: string): Promise<IntentResult>;
17
77
 
18
- export { Botcierge, type BotciergeConfig, type IntentResult, query_intent };
78
+ export { Botcierge, type BotciergeConfig, type Company, CompanyEmbeddingManager, type IntentResult, type MongoEmbeddingConfig, addCompany, closeConnection, companyToText, parseCSV, queryCompanies, query_intent, removeCompany, seedCompanies };
package/dist/index.js CHANGED
@@ -1,8 +1,24 @@
1
1
  import {
2
2
  Botcierge,
3
- query_intent
4
- } from "./chunk-45PYBUYK.js";
3
+ CompanyEmbeddingManager,
4
+ addCompany,
5
+ closeConnection,
6
+ companyToText,
7
+ parseCSV,
8
+ queryCompanies,
9
+ query_intent,
10
+ removeCompany,
11
+ seedCompanies
12
+ } from "./chunk-UKIYZY2F.js";
5
13
  export {
6
14
  Botcierge,
7
- query_intent
15
+ CompanyEmbeddingManager,
16
+ addCompany,
17
+ closeConnection,
18
+ companyToText,
19
+ parseCSV,
20
+ queryCompanies,
21
+ query_intent,
22
+ removeCompany,
23
+ seedCompanies
8
24
  };
package/dist/main.cjs CHANGED
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  var readline = __toESM(require("readline"), 1);
27
27
 
28
28
  // src/index.ts
29
- var import_transformers = require("@xenova/transformers");
29
+ var import_transformers2 = require("@xenova/transformers");
30
30
 
31
31
  // src/intents.ts
32
32
  var INTENTS_TAXONOMY = {
@@ -165,6 +165,10 @@ var INTENTS_TAXONOMY = {
165
165
  }
166
166
  };
167
167
 
168
+ // src/companyEmbeddings.ts
169
+ var import_mongodb = require("mongodb");
170
+ var import_transformers = require("@xenova/transformers");
171
+
168
172
  // src/index.ts
169
173
  var extractorPromise = null;
170
174
  function getExtractor() {
@@ -172,7 +176,7 @@ function getExtractor() {
172
176
  extractorPromise = (async () => {
173
177
  console.log("Loading local embedding model 'Xenova/all-MiniLM-L12-v2'...");
174
178
  console.log("Note: On first run, this will download the model files (approx. 120MB).");
175
- const extractor = await (0, import_transformers.pipeline)("feature-extraction", "Xenova/all-MiniLM-L12-v2");
179
+ const extractor = await (0, import_transformers2.pipeline)("feature-extraction", "Xenova/all-MiniLM-L12-v2");
176
180
  console.log("Local embedding model loaded successfully.");
177
181
  return extractor;
178
182
  })();
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  query_intent
3
- } from "./chunk-45PYBUYK.js";
3
+ } from "./chunk-UKIYZY2F.js";
4
4
 
5
5
  // src/main.ts
6
6
  import * as readline from "readline";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@horribleprogram/sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "SDK for Botcierge Intent Classification",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,6 +44,7 @@
44
44
  "vitest": "^4.1.6"
45
45
  },
46
46
  "dependencies": {
47
- "@xenova/transformers": "^2.17.2"
47
+ "@xenova/transformers": "^2.17.2",
48
+ "mongodb": "^7.4.0"
48
49
  }
49
50
  }