- Docs can be found here.
- Typesafe queries. Written in typescript.
- Bindings are included in the package.
- Bindings for reasonml/bucklescript/rescript and flow.js coming soon.
npm install @whitehead/sdk
This package ships with a CLI-based playground for quickly trying out queries and APIs.
You can call it directly if installed globally. You need to set WHITEHEAD_DEVELOPER_ID and WHITEHEAD_API_KEY environment variables for authentication.
npm i -g @whitehead/sdk
# Or if using yarn:# yarn global add @whitehead/sdk# Set auth variables; see the Developers section on the dashboard for thisexport WHITEHEAD_DEVELOPER_ID=<developer_id>export WHITEHEAD_API_KEY="<developer_api_key>"
whitehead-playgroundconst{ Whitehead }=require("@whitehead/sdk");// If using esm:// import Whitehead from "@whitehead/sdk/esm";// Check the Developers section on the dashboard for this.constdeveloperId=999;constapiKey="<64 letter api key from your whitehead dashboard>";constclient=newWhitehead: ({ developerId, apiKey });// Start async block(async()=>{awaitclient.initialize();// See API list for more infoconstresult=awaitclient.chitchat(input,history);console.log(result);// Do something with the result})().then(console.log,console.error);Answer plain-language questions from a given context
answer: (input: string,options: {context?: string|undefined}): string=>result;Answer plain-language questions from a given context, including a set of documents
choose: (input: string,options: {context?: string|undefined}): string=>result;Conduct free-form chit-chat with your users
chitchat: (input: string,options: {history: Turn[]}): string=>result;Tag dialog utterances with dialog acts
dialogact: (input: string): string=>result;Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.
paraphrase: (input: string): string=>result;relations: (input: string,options: {relation: Relation}): string[]=>result;Rank a list of inputs according to how sensible they are in a given context
sensibility: (input: string,options: {history: Turn[]}): {alternative: string;score: number}[]=>result;Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.
sentiment: (input: string): {score: number;label: string}=>result;Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.
similarity: (input: string,options: {candidates: string[]}): {candidate: string;score: number}[]=>result;Takes text (string) as input and returns audio encoded as a base64 string.
speak: (input: string): string=>result;// base64 encoded audioMine topics from a given input
topics: (input: string,options: {topics: string[]}): {score: number;topic: string}[]=>result;Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).
transcribe: (input: string): string=>result;- The
esm/directory is marked as a nodejs-native ES module usingesm/package.json
- Edit files in
src/directory - Run
npm run build - Add test cases in
tests/directory. File names need to start withtest_. - Make sure to set env vars:
export WHITEHEAD_DEVELOPER_ID=XX WHITEHEAD_API_KEY=XXX - Run
npm test
- If build successful, before committing results, run
npm run version bump. npm publish --access public
Docs are built using typedoc and published on github pages.
- Run
npm run docs - Commit all changes,
- Then
git checkout gh-pagesandgit merge <original-branch> git push origin gh-pages
- Install GNU parallel command
- Run
NUM=100 npm run load-test
