Qwebeck / conversational-ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Acronym - Title: CONVAI-12 Authors: Bohdan Forostianyi, Jakub Koźliak Year, Group: 2023, group 4

Contents list

1. Introduction

The bot is designed to act as an intermediary between Discord users and the Wikipedia platform. It will leverage the Wikipedia API to provide users with access to relevant information and resources from the platform directly through Discord.

Additionally, the bot will include a feature that allows users to receive recommendations for similar articles based on their search history or by passing an article as an argument. This feature will provide users with a personalized experience and facilitate discovery of related topics of interest.

2. Theoretical background/technology stack

Application will consists of two parts: first is a bot itself, second - language extraction model based in the cloud which will be able to analyze user history and provide recomendations.

Language Model

As a model provider will be used Microsoft Azure and its KeyPhrases Service

Normally this service is paid

image

however, Azure allows for creation of a free account which goes with 200 USD credits for use in the first month, which should be sufficient for demo.

image

Discord Bot

Bot part of the project will be based on Python Discord API

It allows to extend basic Discord Server functionality by making event driven application for custom handling user's behaviour, in our case: reacting for text chat messages defined below.

Discord API provides easy way to integrate with user's Server by attaching extension to Server configuration.

3. Case study concept description

The bot with provide users with two commands:

  • /search [query] - which will search for an articles with title matching provided query and disaply it on Discord
  • /recommend - which will recommend articles to the user based on his search history

4. Solution architecture

Architecture Diagram

Blank diagram - Page 1

Sequential diagram of proposed queries

Blank diagram - Sequence diagram

5. Environment configuration description

Our bot will be used on Discord Server as an extension for regular text channels. By default it will be available for every user on server, allowing them to search articles using WikipediaAPI.

Bot will need access to KeyPhraseService, which can be configured during bot installation on Discord Server.

WikipediaAPI is free to use, no need for further configuration.

6. Installation method

In order to install and bot install dependencies from requirements.txt file with pip install -r requirements.txt.

7. How to reproduce - step by step

(assuming that you want to add bot to your existing server)

  1. Clone repository, install dependencies and configure .env file (see Configuration set-up)
  2. To start a bot you should run python bot.py command.
  3. Add bot to your server, you can use this link: https://discord.com/api/oauth2/authorize?client_id=[CLIENT_ID]&permissions=0&scope=bot, where your should replace [CLIENT_ID] with your bot's client id (you can get it from Discord Developer Portal -> Applications -> [Your Application] -> OAuth2 -> Client ID)

8. Demo deployment steps

Configuration set-up

Create .env file with following variables: - DISCORD_TOKEN - token for Discord Bot (you can get it from Discord Developer Portal -> Applications -> [Your Application] -> Bot -> Token) - KEY_PHRASE_SERVICE_ENDPOINT - endpoint for KeyPhraseService (you can get it from Azure Portal -> Resources -> [Your Resource Name] -> Keys and Endpoints -> Endpoint) - KEY_PHRASE_SERVICE_KEY - key for KeyPhraseService (you can get it from Azure Portal -> Resources -> [Your Resource Name] -> Keys and Endpoints -> Key 1)

Execution procedure

On your server type: /search [query] to search for an article with title matching provided query. Bot will return 10 articles most relevant to your request. After that run recommend, which will return 10 articles most relevant to your search history.

Results presentation

Let's assume our user was recently interested in fantasy and searched for topics related to orcs and to world of Warcraft, as it shown below.

image

image

After some time he found an information about everything he needed and decides to ask for recomendation. So he types command recommend and he is presented with the following results image

9. Summary – conclusions

Discord provides a simple way to extend its functionality by creating custom bots which does not require a lot of configuration. Messanger nature of Discord makes it a perfect platform for conversational AIs, that can interact with users and help them with their daily tasks, by reading text messages or even interacting with voice commands. In this project we deomnstrated how to create a simple bot which can search Wikipedia articles and recommend new ones based on user's search history. The platform used for Conversational AI was Microsoft Azure, which provides a lot of services for Natural Language Processing, including KeyPhraseService. However, it is not the only one, and we do claim that it is the cheapest one: during development authors made requests to approximately 200 documents extractions and spent 20$ of their subscription. So before using it in production more in depth comparison between other provides (e.g. Amazon, OpenAI) should be done before making a decision.

Reference

About


Languages

Language:Python 100.0%