Socket
Socket
Sign inDemoInstall

qna-builder

Package Overview
Dependencies
3
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    qna-builder

Similarity-based conversational dialog engine for Python.


Maintainers
1

Readme

QnA Builder

QnA Builder logo

Introduction

QnA Builder is a simple, no-code way to build chatbots in Python. It provides a similarity-based conversational dialog engine, QnA Bot, which makes it easy to generate automated responses to input questions according to a set of known conversations, i.e., question-answer pairs, stored in a knowledge base. QnA Bot relies on a collection of question-answer pairs to generate answers for new inputs.

Install

The easiest way to install the qna-builder is by using pip:

pip install qna-builder

This library is shipped as an all-in-one module implementation with minimalistic dependencies and requirements.

Getting started

A QnA Bot can be set up and used in four simple steps:

  1. Import QnABot class
from qnabuilder import QnABot
  1. Initialize a bot
bot = QnABot()
  1. Fit the bot engine to a knowledge base
bot.fit(kb="knowledge_base.json")
  1. Generate answers
bot.answer("Hey. What's up?")

"All good. What's up with you?"

Algorithms

Currently, QnA Bot engine supports the following algorithms for similarity-based answer generation:

  • TF-IDF Vectorization ('tfidf')
  • Murmurhash3 Vectorization ('murmurhash')
  • Count Vectorization ('count')

Supported similarity metrics are as follows:

  • Cosine similarity ('cosine')
  • Euclidean distance ('euclidean')
  • Manhattan distance ('manhattan')

Knowledge base editor

By calling run_editor() method of QnAKnowledgeBase class, the knowledge base editor window will open up in your web browser and allows you to edit your knowledge base by adding, removing, or modifying questions/answers.

from qnabuilder import QnAKnowledgeBase

kb = QnAKnowledgeBase('my_knowledge_base.json')
kb.run_editor()

Here, you can see a screenshot of the knowledge base editor:

QnA Bot Knowledge Base Editor

Note that you need to install the optional requirement streamlit to be able to use the knowledge base editor.

Tests

To run the tests, install development requirements:

pip install -r requirements_dev.txt

Then, run pytest:

pytest

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc