The Embeddify Node library provides convenient access to the Embeddify API from applications written in server-side JavaScript.
See the embeddify-node
API docs for Node.js.
See [video demonstrations][youtube-playlist] covering how to use the library.
Node 14 or higher.
Install the package with:
npm install embeddify-node
# or
yarn add embeddify-node
The package needs to be configured with your account's secret key, which is available in the Embeddify Dashboard. Require it with the key's value:
const embeddify = require('embeddify-node')('API_KEY');
const indexName = 'salesforce_customer_intent';
const dataRow = {
customerId: '123u9812u3',
text: `Sarah is an investor with a particular interest in
precious metals, especially gold.
Sarah thinks of gold as a stable investment.
She expressed a strong intent to diversify her portfolio
with gold investment products such as gold bullion
and gold-backed ETFs.
`};
(async () => {
await embeddify.index.generateEmbeddings(indexName, dataRow);
})();
Or using ES modules and async
/await
:
import Embeddify from 'embeddify-node';
const embeddify = new Embeddify('API_KEY');
const indexName = 'salesforce_customer_intent';
const dataRow = {
customerId: '123u9812u3',
text: `Sarah is an investor with a particular interest in
precious metals, especially gold.
Sarah thinks of gold as a stable investment.
She expressed a strong intent to diversify her portfolio
with gold investment products such as gold bullion
and gold-backed ETFs.
`};
(async () => {
await embeddify.index.generateEmbeddings(indexName, dataRow);
})();
New features and bug fixes are released on the latest major version of the embeddify-node
package. If you are on an older
major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including
those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will
not be receiving any updates.
...