@ondewo/nlu-client-nodejs
v7.0.1
Published
ONDEWO Natural Language Understanding (NLU) Client library for Nodejs
Readme
Overview
@ondewo/nlu-client-nodejs is a compiled version of the ONDEWO NLU API using the ONDEWO PROTO COMPILER. Here you can find the NLU API documentation.
ONDEWO APIs use Protocol Buffers version 3 (proto3) as their Interface Definition Language (IDL) to define the API interface and the structure of the payload messages. The same interface definition is used for gRPC versions of the API in all languages.
Setup
Using NPM:
npm i --save @ondewo/nlu-client-nodejsUsing GitHub:
git clone https://github.com/ondewo/ondewo-nlu-client-nodejs.git ## Clone repository
cd ondewo-nlu-client-nodejs ## Change into repo-directoy
make setup_developer_environment_locally ## Install dependenciesPackage structure
npm
├── api
│ ├── google
│ │ ├── api
│ │ │ ├── annotations_grpc_pb.js
│ │ │ ├── annotations_pb.d.ts
│ │ │ └── annotations_pb.js
│ │ ├── protobuf
│ │ │ ├── any_grpc_pb.js
│ │ │ ├── any_pb.d.ts
│ │ │ ├── any_pb.js
│ │ │ ├── empty_grpc_pb.js
│ │ │ ├── empty_pb.d.ts
│ │ │ ├── empty_pb.js
│ │ │ ├── ...
│ │ ├── rpc
│ │ │ ├── status_grpc_pb.js
│ │ │ ├── status_pb.d.ts
│ │ │ └── status_pb.js
│ │ └── type
│ │ ├── latlng_grpc_pb.js
│ │ ├── latlng_pb.d.ts
│ │ └── latlng_pb.js
│ └── ondewo
│ ├── nlu
│ │ ├── agent_grpc_pb.d.ts
│ │ ├── agent_grpc_pb.js
│ │ ├── agent_pb.d.ts
│ │ ├── agent_pb.js
│ │ ├── aiservices_grpc_pb.d.ts
│ │ ├── aiservices_grpc_pb.js
│ │ ├── aiservices_pb.d.ts
│ │ ├── aiservices_pb.js
│ │ ├── ...
│ └── qa
│ ├── qa_grpc_pb.d.ts
│ ├── qa_grpc_pb.js
│ ├── qa_pb.d.ts
│ └── qa_pb.js
├── LICENSE
├── package.json
├── public-api.d.ts
└── README.mdAuthentication
All RPCs are authenticated with a Keycloak-issued bearer token. Obtain one with the offline-token login helper shipped in the package and attach it to each call as the Authorization gRPC metadata header.
import { login } from '@ondewo/nlu-client-nodejs/auth/offlineTokenProvider';
const provider = await login({
keycloakUrl: 'https://auth.example.com/auth',
realm: 'ondewo-ccai-platform',
clientId: 'ondewo-nlu-cai-sdk-public',
username: '[email protected]',
password: '...'
});
// `Bearer <jwt>` — set this as the `Authorization` gRPC metadata on each request.
const authorizationHeader = provider.getAuthorizationHeader();login(...) returns an OfflineTokenProvider whose access token is auto-refreshed in the background; call provider.stop() when you are done. The legacy cai-token / HTTP-basic credentials no longer exist. See the examples/ directory for a full Agents.ListAgents RPC example.
