@nuclia/core
TypeScript icon, indicating that this package has built-in type declarations

1.14.7 • Public • Published

Nuclia JavaScript SDK

Nuclia SDK is an open-source library wrapping Nuclia API in order to integrate Nuclia services in your frontend application.

It supports both JavaScript and TypeScript.

The full documentation is available at https://docs.nuclia.dev/docs/docs/sdk/js-sdk/.

Basic usage

import { Nuclia } from '@nuclia/core';

const nuclia = new Nuclia({
  backend: 'https://nuclia.cloud/api',
  zone: 'europe-1',
  knowledgeBox: '<YOUR-KB-ID>',
});
nuclia.knowledgeBox
  .search('where does the Little Prince live', [Search.Features.PARAGRAPH])
  .subscribe((searchResult) => {
    console.log('search result', searchResult);
  });

Usage with NodeJS

This SDK can work in NodeJS by providing some polyfills for localStorage and fetch:

const { Nuclia } = require('@nuclia/core');
require('localstorage-polyfill');
require('isomorphic-unfetch');

const nuclia = new Nuclia({
  backend: 'https://nuclia.cloud/api',
  zone: 'europe-1',
  knowledgeBox: '<YOUR-KB-ID>',
});

Readme

Keywords

Package Sidebar

Install

npm i @nuclia/core

Weekly Downloads

162

Version

1.14.7

License

MIT

Unpacked Size

480 kB

Total Files

75

Last publish

Collaborators

  • ebrehault
  • ramon-nuclia
  • ramonnb