From 53546f890de8f6bb245b0c8dc7af88458d708c0c Mon Sep 17 00:00:00 2001 From: Michele Riva Date: Tue, 10 Dec 2024 09:41:57 +0100 Subject: [PATCH] fix: fixes embeddings generation via plugin-embeddings (#849) (#852) --- packages/orama/src/components/hooks.ts | 1 - packages/orama/src/methods/search-hybrid.ts | 1 + packages/orama/src/methods/search-vector.ts | 2 + packages/orama/src/trees/vector.ts | 1 + packages/orama/src/utils.ts | 2 +- packages/orama/tests/utils.test.ts | 68 ++-- packages/plugin-embeddings/src/index.ts | 21 +- pnpm-lock.yaml | 334 ++++++++++++++++++-- 8 files changed, 374 insertions(+), 56 deletions(-) diff --git a/packages/orama/src/components/hooks.ts b/packages/orama/src/components/hooks.ts index a3ba4c95a..081ed4703 100644 --- a/packages/orama/src/components/hooks.ts +++ b/packages/orama/src/components/hooks.ts @@ -93,7 +93,6 @@ export function runBeforeSearch( language: string | undefined ): Promise | void { const needAsync = hooks.some(isAsyncFunction) - if (needAsync) { return (async () => { for (const hook of hooks) { diff --git a/packages/orama/src/methods/search-hybrid.ts b/packages/orama/src/methods/search-hybrid.ts index 8dcbefde5..9a740d7c7 100644 --- a/packages/orama/src/methods/search-hybrid.ts +++ b/packages/orama/src/methods/search-hybrid.ts @@ -93,6 +93,7 @@ export function hybridSearch(...sets: Set[]): Set { // Fast path 1 if (sets.length === 0) { diff --git a/packages/orama/tests/utils.test.ts b/packages/orama/tests/utils.test.ts index f5c1cf03c..3df2277d9 100644 --- a/packages/orama/tests/utils.test.ts +++ b/packages/orama/tests/utils.test.ts @@ -1,33 +1,33 @@ import t from 'tap' -import { formatBytes, formatNanoseconds, getOwnProperty, getNested, flattenObject, setUnion, setIntersection } from '../src/utils.js' +import { formatBytes, formatNanoseconds, getOwnProperty, getNested, flattenObject, setUnion, setIntersection, isAsyncFunction } from '../src/utils.js' t.test('utils', async (t) => { t.test('should correctly format bytes', async (t) => { - t.equal(await formatBytes(0), '0 Bytes') - t.equal(await formatBytes(1), '1 Bytes') - t.equal(await formatBytes(1024), '1 KB') - t.equal(await formatBytes(1024 ** 2), '1 MB') - t.equal(await formatBytes(1024 ** 3), '1 GB') - t.equal(await formatBytes(1024 ** 4), '1 TB') - t.equal(await formatBytes(1024 ** 5), '1 PB') - t.equal(await formatBytes(1024 ** 6), '1 EB') - t.equal(await formatBytes(1024 ** 7), '1 ZB') + t.equal(formatBytes(0), '0 Bytes') + t.equal(formatBytes(1), '1 Bytes') + t.equal(formatBytes(1024), '1 KB') + t.equal(formatBytes(1024 ** 2), '1 MB') + t.equal(formatBytes(1024 ** 3), '1 GB') + t.equal(formatBytes(1024 ** 4), '1 TB') + t.equal(formatBytes(1024 ** 5), '1 PB') + t.equal(formatBytes(1024 ** 6), '1 EB') + t.equal(formatBytes(1024 ** 7), '1 ZB') }) t.test('should correctly format nanoseconds', async (t) => { - t.equal(await formatNanoseconds(1n), '1ns') - t.equal(await formatNanoseconds(10n), '10ns') - t.equal(await formatNanoseconds(100n), '100ns') - t.equal(await formatNanoseconds(1_000n), '1μs') - t.equal(await formatNanoseconds(10_000n), '10μs') - t.equal(await formatNanoseconds(100_000n), '100μs') - t.equal(await formatNanoseconds(1_000_000n), '1ms') - t.equal(await formatNanoseconds(10_000_000n), '10ms') - t.equal(await formatNanoseconds(100_000_000n), '100ms') - t.equal(await formatNanoseconds(1000_000_000n), '1s') - t.equal(await formatNanoseconds(10_000_000_000n), '10s') - t.equal(await formatNanoseconds(100_000_000_000n), '100s') - t.equal(await formatNanoseconds(1000_000_000_000n), '1000s') + t.equal(formatNanoseconds(1n), '1ns') + t.equal(formatNanoseconds(10n), '10ns') + t.equal(formatNanoseconds(100n), '100ns') + t.equal(formatNanoseconds(1_000n), '1μs') + t.equal(formatNanoseconds(10_000n), '10μs') + t.equal(formatNanoseconds(100_000n), '100μs') + t.equal(formatNanoseconds(1_000_000n), '1ms') + t.equal(formatNanoseconds(10_000_000n), '10ms') + t.equal(formatNanoseconds(100_000_000n), '100ms') + t.equal(formatNanoseconds(1000_000_000n), '1s') + t.equal(formatNanoseconds(10_000_000_000n), '10s') + t.equal(formatNanoseconds(100_000_000_000n), '100s') + t.equal(formatNanoseconds(1000_000_000_000n), '1000s') }) t.test('should check object properties', async (t) => { @@ -95,6 +95,28 @@ t.test('utils', async (t) => { t.equal((flattened as Record).foo, 'bar') t.equal(flattened['nested.nested2.nested3.bar'], 'baz') }) + + // This test is skipped because the implementation of isAsyncFunction is temporary and will be + // removed in a future version of Orama. + t.skip('should correctly detect an async function', t => { + async function asyncFunction() { + return 'async' + } + + function returnPromise() { + return new Promise((resolve) => { + resolve('promise') + }) + } + + function syncFunction() { + return 'sync' + } + + t.equal(isAsyncFunction(asyncFunction), true) + t.equal(isAsyncFunction(returnPromise), false) // Returing a promise is not async, JS cannot detect it as async + t.equal(isAsyncFunction(syncFunction), false) + }) }) t.test('setUnion', async t => { diff --git a/packages/plugin-embeddings/src/index.ts b/packages/plugin-embeddings/src/index.ts index 759925c25..6e99b3e0d 100644 --- a/packages/plugin-embeddings/src/index.ts +++ b/packages/plugin-embeddings/src/index.ts @@ -25,6 +25,11 @@ function getPropertiesValues(schema: object, properties: string[]) { .join('. ') } +function normalizeVector(v: number[]): number[] { + const norm = Math.sqrt(v.reduce((sum, val) => sum + val * val, 0)); + return v.map(val => val / norm); +} + export const embeddingsType = 'vector[512]' export async function pluginEmbeddings(pluginParams: PluginEmbeddingsParams): Promise { @@ -49,9 +54,9 @@ export async function pluginEmbeddings(pluginParams: PluginEmbeddingsParams): Pr console.log(`Generating embeddings for properties "${properties.join(', ')}": "${values}"`) } - const embeddings = await model.embed(values) + const embeddings = Array.from(await (await model.embed(values)).data()) - params[pluginParams.embeddings.defaultProperty] = (await embeddings.data()) as unknown as number[] + params[pluginParams.embeddings.defaultProperty] = normalizeVector(embeddings) }, async beforeSearch(_db: AnyOrama, params: SearchParams>) { @@ -64,21 +69,25 @@ export async function pluginEmbeddings(pluginParams: PluginEmbeddingsParams): Pr } if (!params.term) { - throw new Error('Neither "term" nor "vector" parameters were provided') + throw new Error('No "term" or "vector" parameters were provided') } - const embeddings = await model.embed(params.term) as unknown as number[] + const embeddings = Array.from(await (await model.embed(params.term)).data()) as unknown as number[] if (!params.vector) { params.vector = { // eslint-disable-next-line // @ts-ignore property: params?.vector?.property ?? pluginParams.embeddings.defaultProperty, - value: embeddings + value: normalizeVector(embeddings) } } + + console.log({ + vector: normalizeVector(embeddings) + }) - params.vector.value = embeddings + params.vector.value = normalizeVector(embeddings) } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18c86d08e..2c5929821 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -514,7 +514,10 @@ importers: version: link:../orama '@tensorflow-models/universal-sentence-encoder': specifier: ^1.3.3 - version: 1.3.3(@tensorflow/tfjs-converter@3.21.0(@tensorflow/tfjs-core@3.21.0(encoding@0.1.13)))(@tensorflow/tfjs-core@3.21.0(encoding@0.1.13)) + version: 1.3.3(@tensorflow/tfjs-converter@4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)))(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)) + '@tensorflow/tfjs-node': + specifier: ^4.22.0 + version: 4.22.0(encoding@0.1.13)(seedrandom@3.0.5) devDependencies: '@types/node': specifier: ^20.9.0 @@ -3241,6 +3244,10 @@ packages: resolution: {integrity: sha512-/gKJun8NNiWGZJkGzI/Ragc53cOdcLNdzjLaIa+GEjguQs0ulsurx8WN0jijdK9yPqDvziX995sMRLyLt1uZMQ==} engines: {node: '>= 0.4'} + '@mapbox/node-pre-gyp@1.0.9': + resolution: {integrity: sha512-aDF3S3rK9Q2gey/WAttUlISduDItz5BU3306M9Eyv6/oS40aMprnopshtlKTykxRNIBEZuRMaZAnbrQ4QtKGyw==} + hasBin: true + '@mdx-js/mdx@1.6.22': resolution: {integrity: sha512-AMxuLxPz2j5/6TpF/XSdKpQP1NlG0z11dFOlq+2IP/lSgl11GY8ji6S/rgsViN/L0BDvHvUMruRb7ub+24LUYA==} @@ -4236,15 +4243,46 @@ packages: '@tensorflow/tfjs-converter': ^3.6.0 '@tensorflow/tfjs-core': ^3.6.0 - '@tensorflow/tfjs-converter@3.21.0': - resolution: {integrity: sha512-12Y4zVDq3yW+wSjSDpSv4HnpL2sDZrNiGSg8XNiDE4HQBdjdA+a+Q3sZF/8NV9y2yoBhL5L7V4mMLDdbZBd9/Q==} + '@tensorflow/tfjs-backend-cpu@4.22.0': + resolution: {integrity: sha512-1u0FmuLGuRAi8D2c3cocHTASGXOmHc/4OvoVDENJayjYkS119fcTcQf4iHrtLthWyDIPy3JiPhRrZQC9EwnhLw==} + engines: {yarn: '>= 1.3.2'} + peerDependencies: + '@tensorflow/tfjs-core': 4.22.0 + + '@tensorflow/tfjs-backend-webgl@4.22.0': + resolution: {integrity: sha512-H535XtZWnWgNwSzv538czjVlbJebDl5QTMOth4RXr2p/kJ1qSIXE0vZvEtO+5EC9b00SvhplECny2yDewQb/Yg==} + engines: {yarn: '>= 1.3.2'} + peerDependencies: + '@tensorflow/tfjs-core': 4.22.0 + + '@tensorflow/tfjs-converter@4.22.0': + resolution: {integrity: sha512-PT43MGlnzIo+YfbsjM79Lxk9lOq6uUwZuCc8rrp0hfpLjF6Jv8jS84u2jFb+WpUeuF4K33ZDNx8CjiYrGQ2trQ==} peerDependencies: - '@tensorflow/tfjs-core': 3.21.0 + '@tensorflow/tfjs-core': 4.22.0 - '@tensorflow/tfjs-core@3.21.0': - resolution: {integrity: sha512-YSfsswOqWfd+M4bXIhT3hwtAb+IV8+ODwIxwdFR/7jTAPZP1wMVnSlpKnXHAN64HFOiP+Tm3HmKusEZ0+09A0w==} + '@tensorflow/tfjs-core@4.22.0': + resolution: {integrity: sha512-LEkOyzbknKFoWUwfkr59vSB68DMJ4cjwwHgicXN0DUi3a0Vh1Er3JQqCI1Hl86GGZQvY8ezVrtDIvqR1ZFW55A==} engines: {yarn: '>= 1.3.2'} + '@tensorflow/tfjs-data@4.22.0': + resolution: {integrity: sha512-dYmF3LihQIGvtgJrt382hSRH4S0QuAp2w1hXJI2+kOaEqo5HnUPG0k5KA6va+S1yUhx7UBToUKCBHeLHFQRV4w==} + peerDependencies: + '@tensorflow/tfjs-core': 4.22.0 + seedrandom: ^3.0.5 + + '@tensorflow/tfjs-layers@4.22.0': + resolution: {integrity: sha512-lybPj4ZNj9iIAPUj7a8ZW1hg8KQGfqWLlCZDi9eM/oNKCCAgchiyzx8OrYoWmRrB+AM6VNEeIT+2gZKg5ReihA==} + peerDependencies: + '@tensorflow/tfjs-core': 4.22.0 + + '@tensorflow/tfjs-node@4.22.0': + resolution: {integrity: sha512-uHrXeUlfgkMxTZqHkESSV7zSdKdV0LlsBeblqkuKU9nnfxB1pC6DtoyYVaLxznzZy7WQSegjcohxxCjAf6Dc7w==} + engines: {node: '>=8.11.0'} + + '@tensorflow/tfjs@4.22.0': + resolution: {integrity: sha512-0TrIrXs6/b7FLhLVNmfh8Sah6JgjBPH4mZ8JGb7NU6WW+cx00qK5BcAZxw7NCzxj6N8MRAIfHq+oNbPUNG5VAg==} + hasBin: true + '@tokenizer/token@0.3.0': resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} @@ -4456,6 +4494,9 @@ packages: '@types/offscreencanvas@2019.3.0': resolution: {integrity: sha512-esIJx9bQg+QYF0ra8GnvfianIY8qWB0GBx54PK5Eps6m+xTj86KLavHv6qDhzKcu5UUOgNfJ2pWaIIV7TRUd9Q==} + '@types/offscreencanvas@2019.7.3': + resolution: {integrity: sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==} + '@types/pako@2.0.3': resolution: {integrity: sha512-bq0hMV9opAcrmE0Byyo0fY3Ew4tgOevJmQ9grUhpXQhYfyLJ1Kqg3P33JT5fdbT2AjeAjR51zqqVjAL/HMkx7Q==} @@ -4546,9 +4587,6 @@ packages: '@types/web-bluetooth@0.0.20': resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} - '@types/webgl-ext@0.0.30': - resolution: {integrity: sha512-LKVgNmBxN0BbljJrVUwkxwRYqzsAEPcZOe6S2T6ZaBDIrFp0qu4FNlpc5sM1tGbXUYFgdVQIoeLk1Y1UoblyEg==} - '@types/wrap-ansi@3.0.0': resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==} @@ -4846,18 +4884,21 @@ packages: '@webassemblyjs/wast-printer@1.12.1': resolution: {integrity: sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==} - '@webgpu/types@0.1.16': - resolution: {integrity: sha512-9E61voMP4+Rze02jlTXud++Htpjyyk8vw5Hyw9FGRrmhHQg2GqbuOfwf5Klrb8vTxc2XWI3EfO7RUHMpxTj26A==} - '@webgpu/types@0.1.21': resolution: {integrity: sha512-pUrWq3V5PiSGFLeLxoGqReTZmiiXwY3jRkIG5sLLKjyqNxrwm/04b4nw7LSmGWJcKk59XOM/YRTUwOzo4MMlow==} + '@webgpu/types@0.1.38': + resolution: {integrity: sha512-7LrhVKz2PRh+DD7+S+PVaFd5HxaWQvoMqBbsV9fNJO1pjUs1P8bM2vQVNfk+3URTqbuTI7gkXi0rfsN0IadoBA==} + '@xtuc/ieee754@1.2.0': resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} '@xtuc/long@4.2.2': resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + abbrev@1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + abbrev@2.0.0: resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -4893,6 +4934,18 @@ packages: resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==} engines: {node: '>= 10.0.0'} + adm-zip@0.5.16: + resolution: {integrity: sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==} + engines: {node: '>=12.0'} + + agent-base@4.3.0: + resolution: {integrity: sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==} + engines: {node: '>= 4.0.0'} + + agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + agent-base@7.1.1: resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} engines: {node: '>= 14'} @@ -4995,9 +5048,17 @@ packages: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} + aproba@2.0.0: + resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} + arch@2.2.0: resolution: {integrity: sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==} + are-we-there-yet@2.0.0: + resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} + engines: {node: '>=10'} + deprecated: This package is no longer supported. + arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} @@ -5698,6 +5759,9 @@ packages: consola@2.15.3: resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} + console-control-strings@1.1.0: + resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} + constant-case@3.0.4: resolution: {integrity: sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==} @@ -5757,6 +5821,9 @@ packages: core-js-pure@3.38.1: resolution: {integrity: sha512-BY8Etc1FZqdw1glX0XNOq2FDwfrg/VGqoZOZCdaL+UmdaqDwQwYXkMJT4t6In+zfEfOJDcM9T0KdbBeJg8KKCQ==} + core-js@3.29.1: + resolution: {integrity: sha512-+jwgnhg6cQxKYIIjGtAHq2nwUOolo9eoFZ4sHfUH09BLXBgxnH4gA0zEd+t+BO2cNB8idaBtZFcFTRjQJRJmAw==} + core-js@3.38.1: resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==} @@ -6122,6 +6189,9 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + delegates@1.0.0: + resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} + depd@1.1.2: resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} engines: {node: '>= 0.6'} @@ -6395,6 +6465,12 @@ packages: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} + es6-promise@4.2.8: + resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} + + es6-promisify@5.0.0: + resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} + esbuild@0.17.19: resolution: {integrity: sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==} engines: {node: '>=12'} @@ -7001,6 +7077,11 @@ packages: functions-have-names@1.2.3: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} + gauge@3.0.2: + resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} + engines: {node: '>=10'} + deprecated: This package is no longer supported. + gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -7138,6 +7219,9 @@ packages: resolution: {integrity: sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==} engines: {node: '>=18'} + google-protobuf@3.21.4: + resolution: {integrity: sha512-MnG7N936zcKTco4Jd2PX2U96Kf9PxygAPKBug+74LHzmHXmceN16MmRcdgZv+DGef/S9YvQAfRsNCn4cjf9yyQ==} + gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} @@ -7216,6 +7300,9 @@ packages: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} + has-unicode@2.0.1: + resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} + has-yarn@2.1.0: resolution: {integrity: sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==} engines: {node: '>=8'} @@ -7516,6 +7603,14 @@ packages: resolution: {integrity: sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==} engines: {node: '>=10.19.0'} + https-proxy-agent@2.2.4: + resolution: {integrity: sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==} + engines: {node: '>= 4.5.0'} + + https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + https-proxy-agent@7.0.5: resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} engines: {node: '>= 14'} @@ -9143,6 +9238,11 @@ packages: node-releases@2.0.18: resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} + nopt@5.0.0: + resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} + engines: {node: '>=6'} + hasBin: true + nopt@7.2.1: resolution: {integrity: sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -9226,6 +9326,10 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + npmlog@5.0.1: + resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} + deprecated: This package is no longer supported. + nprogress@0.2.0: resolution: {integrity: sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==} @@ -10208,6 +10312,10 @@ packages: resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} engines: {node: '>= 0.6.0'} + progress@2.0.3: + resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} + engines: {node: '>=0.4.0'} + promise-inflight@1.0.1: resolution: {integrity: sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==} peerDependencies: @@ -10496,6 +10604,9 @@ packages: regenerate@1.4.2: resolution: {integrity: sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==} + regenerator-runtime@0.13.11: + resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} + regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} @@ -10831,6 +10942,11 @@ packages: rfdc@1.4.1: resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} + rimraf@2.7.1: + resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} deprecated: Rimraf versions prior to v4 are no longer supported @@ -11012,6 +11128,9 @@ packages: server-destroy@1.0.1: resolution: {integrity: sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==} + set-blocking@2.0.0: + resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} + set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} engines: {node: '>= 0.4'} @@ -12662,6 +12781,9 @@ packages: engines: {node: ^16.13.0 || >=18.0.0} hasBin: true + wide-align@1.1.5: + resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} + widest-line@3.1.0: resolution: {integrity: sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==} engines: {node: '>=8'} @@ -16531,6 +16653,21 @@ snapshots: dependencies: call-bind: 1.0.7 + '@mapbox/node-pre-gyp@1.0.9(encoding@0.1.13)': + dependencies: + detect-libc: 2.0.3 + https-proxy-agent: 5.0.1 + make-dir: 3.1.0 + node-fetch: 2.7.0(encoding@0.1.13) + nopt: 5.0.0 + npmlog: 5.0.1 + rimraf: 3.0.2 + semver: 7.6.3 + tar: 6.2.1 + transitivePeerDependencies: + - encoding + - supports-color + '@mdx-js/mdx@1.6.22': dependencies: '@babel/core': 7.12.9 @@ -17856,28 +17993,87 @@ snapshots: dependencies: '@tapjs/core': 4.0.0(@swc/core@1.7.35(@swc/helpers@0.5.5))(@types/node@20.16.11)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@tensorflow-models/universal-sentence-encoder@1.3.3(@tensorflow/tfjs-converter@3.21.0(@tensorflow/tfjs-core@3.21.0(encoding@0.1.13)))(@tensorflow/tfjs-core@3.21.0(encoding@0.1.13))': + '@tensorflow-models/universal-sentence-encoder@1.3.3(@tensorflow/tfjs-converter@4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)))(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13))': dependencies: - '@tensorflow/tfjs-converter': 3.21.0(@tensorflow/tfjs-core@3.21.0(encoding@0.1.13)) - '@tensorflow/tfjs-core': 3.21.0(encoding@0.1.13) + '@tensorflow/tfjs-converter': 4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)) + '@tensorflow/tfjs-core': 4.22.0(encoding@0.1.13) - '@tensorflow/tfjs-converter@3.21.0(@tensorflow/tfjs-core@3.21.0(encoding@0.1.13))': + '@tensorflow/tfjs-backend-cpu@4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13))': dependencies: - '@tensorflow/tfjs-core': 3.21.0(encoding@0.1.13) + '@tensorflow/tfjs-core': 4.22.0(encoding@0.1.13) + '@types/seedrandom': 2.4.34 + seedrandom: 3.0.5 - '@tensorflow/tfjs-core@3.21.0(encoding@0.1.13)': + '@tensorflow/tfjs-backend-webgl@4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13))': dependencies: - '@types/long': 4.0.2 + '@tensorflow/tfjs-backend-cpu': 4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)) + '@tensorflow/tfjs-core': 4.22.0(encoding@0.1.13) '@types/offscreencanvas': 2019.3.0 '@types/seedrandom': 2.4.34 - '@types/webgl-ext': 0.0.30 - '@webgpu/types': 0.1.16 + seedrandom: 3.0.5 + + '@tensorflow/tfjs-converter@4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13))': + dependencies: + '@tensorflow/tfjs-core': 4.22.0(encoding@0.1.13) + + '@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)': + dependencies: + '@types/long': 4.0.2 + '@types/offscreencanvas': 2019.7.3 + '@types/seedrandom': 2.4.34 + '@webgpu/types': 0.1.38 long: 4.0.0 node-fetch: 2.6.13(encoding@0.1.13) seedrandom: 3.0.5 transitivePeerDependencies: - encoding + '@tensorflow/tfjs-data@4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13))(encoding@0.1.13)(seedrandom@3.0.5)': + dependencies: + '@tensorflow/tfjs-core': 4.22.0(encoding@0.1.13) + '@types/node-fetch': 2.6.11 + node-fetch: 2.6.13(encoding@0.1.13) + seedrandom: 3.0.5 + string_decoder: 1.3.0 + transitivePeerDependencies: + - encoding + + '@tensorflow/tfjs-layers@4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13))': + dependencies: + '@tensorflow/tfjs-core': 4.22.0(encoding@0.1.13) + + '@tensorflow/tfjs-node@4.22.0(encoding@0.1.13)(seedrandom@3.0.5)': + dependencies: + '@mapbox/node-pre-gyp': 1.0.9(encoding@0.1.13) + '@tensorflow/tfjs': 4.22.0(encoding@0.1.13)(seedrandom@3.0.5) + adm-zip: 0.5.16 + google-protobuf: 3.21.4 + https-proxy-agent: 2.2.4 + progress: 2.0.3 + rimraf: 2.7.1 + tar: 6.2.1 + transitivePeerDependencies: + - encoding + - seedrandom + - supports-color + + '@tensorflow/tfjs@4.22.0(encoding@0.1.13)(seedrandom@3.0.5)': + dependencies: + '@tensorflow/tfjs-backend-cpu': 4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)) + '@tensorflow/tfjs-backend-webgl': 4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)) + '@tensorflow/tfjs-converter': 4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)) + '@tensorflow/tfjs-core': 4.22.0(encoding@0.1.13) + '@tensorflow/tfjs-data': 4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13))(encoding@0.1.13)(seedrandom@3.0.5) + '@tensorflow/tfjs-layers': 4.22.0(@tensorflow/tfjs-core@4.22.0(encoding@0.1.13)) + argparse: 1.0.10 + chalk: 4.1.2 + core-js: 3.29.1 + regenerator-runtime: 0.13.11 + yargs: 16.2.0 + transitivePeerDependencies: + - encoding + - seedrandom + '@tokenizer/token@0.3.0': {} '@trysound/sax@0.2.0': {} @@ -18117,6 +18313,8 @@ snapshots: '@types/offscreencanvas@2019.3.0': {} + '@types/offscreencanvas@2019.7.3': {} + '@types/pako@2.0.3': {} '@types/parse-json@4.0.2': {} @@ -18210,8 +18408,6 @@ snapshots: '@types/web-bluetooth@0.0.20': {} - '@types/webgl-ext@0.0.30': {} - '@types/wrap-ansi@3.0.0': {} '@types/ws@8.5.12': @@ -18631,14 +18827,16 @@ snapshots: '@webassemblyjs/ast': 1.12.1 '@xtuc/long': 4.2.2 - '@webgpu/types@0.1.16': {} - '@webgpu/types@0.1.21': {} + '@webgpu/types@0.1.38': {} + '@xtuc/ieee754@1.2.0': {} '@xtuc/long@4.2.2': {} + abbrev@1.1.1: {} + abbrev@2.0.0: {} abort-controller@3.0.0: @@ -18666,6 +18864,18 @@ snapshots: address@1.2.2: {} + adm-zip@0.5.16: {} + + agent-base@4.3.0: + dependencies: + es6-promisify: 5.0.0 + + agent-base@6.0.2: + dependencies: + debug: 4.3.7 + transitivePeerDependencies: + - supports-color + agent-base@7.1.1: dependencies: debug: 4.3.7 @@ -18776,8 +18986,15 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.1 + aproba@2.0.0: {} + arch@2.2.0: {} + are-we-there-yet@2.0.0: + dependencies: + delegates: 1.0.0 + readable-stream: 3.6.2 + arg@4.1.3: {} arg@5.0.2: {} @@ -19773,6 +19990,8 @@ snapshots: consola@2.15.3: {} + console-control-strings@1.1.0: {} + constant-case@3.0.4: dependencies: no-case: 3.0.4 @@ -19821,6 +20040,8 @@ snapshots: core-js-pure@3.38.1: {} + core-js@3.29.1: {} + core-js@3.38.1: {} core-util-is@1.0.3: {} @@ -20247,6 +20468,8 @@ snapshots: delayed-stream@1.0.0: {} + delegates@1.0.0: {} + depd@1.1.2: {} depd@2.0.0: {} @@ -20558,6 +20781,12 @@ snapshots: is-date-object: 1.0.5 is-symbol: 1.0.4 + es6-promise@4.2.8: {} + + es6-promisify@5.0.0: + dependencies: + es6-promise: 4.2.8 + esbuild@0.17.19: optionalDependencies: '@esbuild/android-arm': 0.17.19 @@ -21457,6 +21686,18 @@ snapshots: functions-have-names@1.2.3: {} + gauge@3.0.2: + dependencies: + aproba: 2.0.0 + color-support: 1.1.3 + console-control-strings: 1.1.0 + has-unicode: 2.0.1 + object-assign: 4.1.1 + signal-exit: 3.0.7 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wide-align: 1.1.5 + gensync@1.0.0-beta.2: {} get-caller-file@2.0.5: {} @@ -21625,6 +21866,8 @@ snapshots: slash: 5.1.0 unicorn-magic: 0.1.0 + google-protobuf@3.21.4: {} + gopd@1.0.1: dependencies: get-intrinsic: 1.2.4 @@ -21728,6 +21971,8 @@ snapshots: dependencies: has-symbols: 1.0.3 + has-unicode@2.0.1: {} + has-yarn@2.1.0: {} has-yarn@3.0.0: {} @@ -22295,6 +22540,20 @@ snapshots: quick-lru: 5.1.1 resolve-alpn: 1.2.1 + https-proxy-agent@2.2.4: + dependencies: + agent-base: 4.3.0 + debug: 3.2.7 + transitivePeerDependencies: + - supports-color + + https-proxy-agent@5.0.1: + dependencies: + agent-base: 6.0.2 + debug: 4.3.7 + transitivePeerDependencies: + - supports-color + https-proxy-agent@7.0.5: dependencies: agent-base: 7.1.1 @@ -24369,6 +24628,10 @@ snapshots: node-releases@2.0.18: {} + nopt@5.0.0: + dependencies: + abbrev: 1.1.1 + nopt@7.2.1: dependencies: abbrev: 2.0.0 @@ -24471,6 +24734,13 @@ snapshots: dependencies: path-key: 4.0.0 + npmlog@5.0.1: + dependencies: + are-we-there-yet: 2.0.0 + console-control-strings: 1.1.0 + gauge: 3.0.2 + set-blocking: 2.0.0 + nprogress@0.2.0: {} nth-check@2.1.1: @@ -25467,6 +25737,8 @@ snapshots: process@0.11.10: {} + progress@2.0.3: {} + promise-inflight@1.0.1: {} promise-retry@2.0.1: @@ -25885,6 +26157,8 @@ snapshots: regenerate@1.4.2: {} + regenerator-runtime@0.13.11: {} + regenerator-runtime@0.14.1: {} regenerator-transform@0.15.2: @@ -26514,6 +26788,10 @@ snapshots: rfdc@1.4.1: {} + rimraf@2.7.1: + dependencies: + glob: 7.2.3 + rimraf@3.0.2: dependencies: glob: 7.2.3 @@ -26754,6 +27032,8 @@ snapshots: server-destroy@1.0.1: {} + set-blocking@2.0.0: {} + set-function-length@1.2.2: dependencies: define-data-property: 1.1.4 @@ -28764,6 +29044,10 @@ snapshots: dependencies: isexe: 3.1.1 + wide-align@1.1.5: + dependencies: + string-width: 4.2.3 + widest-line@3.1.0: dependencies: string-width: 4.2.3