JSPM

@aristech-org/nlp-client

2.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q44374F
  • License MIT

A Node.js client library for the Aristech NLP Service

Package Exports

  • @aristech-org/nlp-client
  • @aristech-org/nlp-client/dist/generated/intents
  • @aristech-org/nlp-client/dist/generated/nlp_server

Readme

Aristech NLP-Client for NodeJS

This is the NodeJS client implementation for the Aristech NLP-Server.

Installation

npm install @aristech-org/nlp-client

Usage

import { NlpClient } from '@aristech-org/nlp-client'

const client = new NlpClient({ host: 'nlp.example.com' })
const response = await client.runFunctions({
  input: 'hello world',
  functions: [{ id: 'spellcheck-de' }]
})
console.log(response)

There are several examples in the examples directory:

  • functions.ts: Demonstrates how to list the available functions.
  • process.ts: Demonstrates how to perform NLP processing on a text.
  • projects.ts: Demonstrates how to list the available projects.
  • intents.ts: Demonstrates how to list intents for a project.
  • scoreLimits.ts: Demonstrates how to use score limits to figure out good thresholds for intents.
  • content.ts: Demonstrates how to search content for a given prompt.

You can run the examples directly using tsx like this:

  1. Create a .env file in the node directory:
HOST=nlp.example.com
# The credentials are optional but probably required for most servers:
TOKEN=your-token
SECRET=your-secret

# The following are optional:
# ROOT_CERT=your-root-cert.pem # If the server uses a self-signed certificate
# SSL=true # Set to true if credentials are provided or if a ROOT_CERT is provided
# PROJECT_ID=your-project-id # Required for some examples
  1. Run the examples, e.g.:
npx tsx examples/functions.ts

Build

To rebuild the generated typescript files from the proto file, run:

npm run generate

To build the library, run:

npm run build