0.26.0 • Published 2 days ago

@botonic/plugin-knowledge-bases v0.26.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

Botonic Plugin Knowledge Bases

What Does This Plugin Do?

This plugin allows you to integrate Hubtype Knowledge bases in your Botonic project. It works like any other AI services plugin, like Hubtype Babel, Dialogflow, Watson, etc.

Setup

  1. Install the plugin from npm (or yarn):
npm i --save @botonic/plugin-knowledge-bases
  1. Add it to the src/plugins.js file defining the projectId of the Project you want to use:
export const plugins = [
  {
    id: 'hubtype-knowledge-bases',
    resolve: require('@botonic/plugin-knowledge-bases'),
    options: {
        knowledgeBaseId: '6800762a-03b5-419e-be97-67feac7bc5b9',
        host: 'https://www.api.hubtype.com'
    },
  },
]

Use

The plugin response contains 3 attributes ai, hasKnowledge, sources. If hasKnowledge is true the response will be in ai and source will be the name of the document from which the response was obtained. If the hasKnowledge parameter is false then it does not have enough knowledge to answer and in that case the answer should not be shown to the user.

You can use it in your actions:

import React from 'react'
import { Text } from '@botonic/react'

export default class OrderLocation extends React.Component {
  static async botonicInit(request) {
    const knowledgePlugin = request.plugins.knwoledgePlugin
    const response = await knowladgeBasePlugin.getInference(request.session)

    return {
      text: response.hasKnowledge
        ? response.ai
        : "I don't know what you're talking about",
    }
  }
  render() {
    return <Text>{this.props.text}</Text>
  }
}

Plugin Options

interface PluginKnowledgeBaseOptions {
  knowledgeBaseId: string
  host: string
  authToken?: string
  timeout?: number
}
  • knowledgeBaseId: Id of the knowledge base previously uploaded to the desk under ai/knowledgebases.
  • [host]: Host uri where to request inference.
  • [authToken]: Authorization Token to being able to run inference. Only needed when using the plugin locally.
  • [timeout]: timeout of the call to the knowledgebases inferrence endpoint.
    • Default: 10 seconds
0.26.0-alpha.0

2 days ago

0.26.1-alpha.0

2 days ago

0.26.0

8 days ago

0.25.0

1 month ago

0.25.0-beta.0

1 month ago

0.24.1

2 months ago

0.24.1-alpha.1

2 months ago

0.24.1-alpha.0

2 months ago

0.25.0-alpha.3

2 months ago

0.25.0-alpha.2

3 months ago

0.25.0-alpha.1

3 months ago

0.25.0-alpha.0

3 months ago

0.24.0

5 months ago

0.23.3

6 months ago

0.23.2

6 months ago

0.23.1

7 months ago

0.23.1-alpha.1

8 months ago

0.23.1-alpha.0

8 months ago

0.23.0

8 months ago

0.23.0-alpha.1

8 months ago

0.23.0-alpha.0

8 months ago