chore: simplify TensorFlow.js imports and bump package version to 0.2.2

Streamlined TensorFlow.js and Universal Sentence Encoder imports by removing unnecessary explicit file paths. Updated package.json version to 0.2.2.
This commit is contained in:
David Snelling 2025-05-27 15:42:38 -07:00
parent b499b27130
commit 7fe32d9e8a
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@soulcraft/brainy",
"version": "0.2.1",
"version": "0.2.2",
"description": "A vector database using HNSW indexing with Origin Private File System storage",
"main": "dist/index.js",
"module": "dist/index.js",

View file

@ -91,8 +91,8 @@ export class UniversalSentenceEncoder implements EmbeddingModel {
try {
// Dynamically import TensorFlow.js and Universal Sentence Encoder
// Use type assertions to tell TypeScript these modules exist
this.tf = await import('@tensorflow/tfjs/dist/tf.esm.js' as any)
this.use = await import('@tensorflow-models/universal-sentence-encoder/dist/universal-sentence-encoder.esm.js' as any)
this.tf = await import('@tensorflow/tfjs')
this.use = await import('@tensorflow-models/universal-sentence-encoder')
// Load the model
this.model = await this.use.load()