<img src="https://th.bing.com/th/id/OIP.HfSXFZI8Bk4GKR98TRIALwHaHa?rs=1&pid=ImgDetMain" width="150" height="150" />
# Botnoi Dev Platform
Botnoi Dev Platform is a programatical alternative to the visual chatbot builder provided by https://botnoi.ai .
It can be used to build and train chatbots for various platforms such as Facebook Messenger and LINE.
This official library provides a Python implementation of Botnoi Dev Platform's API in order to simplify the process of building chatbots.
It also provides various data types related to chatbots such as 'Intent', 'Object' and lots of helper functions to work with them.
This suits best for developers who want to build chatbots programmatically or to automate the process of chatbot training when an action is performed by the applications' users.
# Installation
Run this command in the terminal
```
pip install BotnoiDevPlatform
```
then, import the package
```python
from BotnoiDevPlatform.cores import BotnoiChatbotServer
from BotnoiDevPlatform.elements import Bot, Intent, Object, IntentKeyword, IntentReaction, ImageObject
from BotnoiDevPlatform.utils import ObjectType, Action
```
note: you have to have an API key to use this package. You can get one from https://botnoi.ai
# Usage
## Set up
First, setup a client with your API key
```python
BotnoiChatbotServer.setup_client('your_api_key')
```
Then, you can create a BotnoiChatbotServer server instance
```python
server = BotnoiChatbotServer()
```
## Create a bot
Creating a bot is simple. You just have to create a bot instance and add it to the server
```python
test_bot = Bot(
botName="test",
businessType="test",
botAvatar="https://console.botnoi.ai/assets/botnoi-logo/botnoi.svg",
sex="male",
age=20,
)
server.create_bot(test_bot)
# reload the bot from the server.
# This is required to get the bot's id from the server.
test_bot.reload()
```
Or find an existing bot by name
```python
test_bot = server.find_bot_with_name("test")
```
## Create and train an intent
You can create an intent by creating a new Intent instance and add it to the bot
```python
test_intent = Intent(name="test_intent")
test_bot.opt.create_intent(test_intent)
# reload the intent from the server.
# This is required to get the intent's id from the server.
test_intent.reload()
```
Or find an existing one by name
```python
test_intent = test_bot.opt.find_intent_with_name("test_intent")
```
notice that the 'opt' property is used when you want to do something with the bot that is related to Botnoi Dev Platform (eg. create_intent, find_intents, etc.). This is the standard for all data types that can directly interact with the server (eg. Bot, Intent, Object, etc.).
You can train the intent by adding some keywords(inputs) and reactions(outputs) to it
```python
test_intent.opt.train_keyword(IntentKeyword("hello"))
test_intent.opt.train_reaction(IntentReaction(["hello!", "it works!"]))
```
Or train the reaction with more complex actions like this
```python
test_intent.opt.train_reaction(
IntentReaction([
Action.image("test_image"), # send an image with name "test_image"
Action.createParameter(parameterName="test_param", parameterValue=Action.get_keyword()), # create a parameter to store the latest message from the user
Action.text("test param is " + Action.parameter("test_param")), # get the parameter and use it in a text,
])
)
```
## Create an object
Creating objects is similar to creating intents. First, create an Object instance with typed objects in its objects property (eg. ApiObject, ImageObject, ButtonObject etc.). Every typed object instances must be of the same type. Then, you can add the Object instance to the bot.
```python
test_image_object = Object(
objectName="test_image",
objects=[
ImageObject(
original_url="https://console.botnoi.ai/assets/botnoi-logo/botnoi.svg",
preview_image_url="https://console.botnoi.ai/assets/botnoi-logo/botnoi.svg",
)
]
)
test_bot.opt.create_object(test_image_object)
```
Or find an existing one by name
```python
test_image_object = test_bot.opt.find_object_with_name("test_image",type=ObjectType.image())
```
Raw data
{
"_id": null,
"home_page": "",
"name": "BotnoiDevPlatform",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "botnoi,chatbot,bot,botnoi dev platform",
"author": "Jira Pit @ BOTNOI GROUP",
"author_email": "<jira.p@botnoigroup.com>",
"download_url": "https://files.pythonhosted.org/packages/94/60/5c869235b2c6153ab76e2c3ff00fcbb38e29aba3f8a8555ce71dd9b9ebeb/BotnoiDevPlatform-0.0.8.tar.gz",
"platform": null,
"description": "<img src=\"https://th.bing.com/th/id/OIP.HfSXFZI8Bk4GKR98TRIALwHaHa?rs=1&pid=ImgDetMain\" width=\"150\" height=\"150\" />\r\n\r\n# Botnoi Dev Platform\r\n\r\nBotnoi Dev Platform is a programatical alternative to the visual chatbot builder provided by https://botnoi.ai .\r\nIt can be used to build and train chatbots for various platforms such as Facebook Messenger and LINE.\r\n\r\nThis official library provides a Python implementation of Botnoi Dev Platform's API in order to simplify the process of building chatbots.\r\nIt also provides various data types related to chatbots such as 'Intent', 'Object' and lots of helper functions to work with them.\r\n\r\nThis suits best for developers who want to build chatbots programmatically or to automate the process of chatbot training when an action is performed by the applications' users.\r\n\r\n# Installation\r\nRun this command in the terminal\r\n```\r\npip install BotnoiDevPlatform\r\n```\r\n\r\nthen, import the package\r\n```python\r\nfrom BotnoiDevPlatform.cores import BotnoiChatbotServer\r\nfrom BotnoiDevPlatform.elements import Bot, Intent, Object, IntentKeyword, IntentReaction, ImageObject\r\nfrom BotnoiDevPlatform.utils import ObjectType, Action\r\n```\r\n\r\nnote: you have to have an API key to use this package. You can get one from https://botnoi.ai\r\n\r\n# Usage\r\n## Set up\r\nFirst, setup a client with your API key\r\n```python\r\nBotnoiChatbotServer.setup_client('your_api_key')\r\n```\r\nThen, you can create a BotnoiChatbotServer server instance\r\n```python\r\nserver = BotnoiChatbotServer()\r\n```\r\n\r\n## Create a bot\r\nCreating a bot is simple. You just have to create a bot instance and add it to the server\r\n```python\r\ntest_bot = Bot(\r\n botName=\"test\",\r\n businessType=\"test\",\r\n botAvatar=\"https://console.botnoi.ai/assets/botnoi-logo/botnoi.svg\",\r\n sex=\"male\",\r\n age=20,\r\n)\r\n\r\nserver.create_bot(test_bot)\r\n\r\n# reload the bot from the server. \r\n# This is required to get the bot's id from the server.\r\ntest_bot.reload() \r\n```\r\n\r\nOr find an existing bot by name\r\n```python\r\ntest_bot = server.find_bot_with_name(\"test\")\r\n```\r\n\r\n## Create and train an intent\r\nYou can create an intent by creating a new Intent instance and add it to the bot\r\n```python\r\ntest_intent = Intent(name=\"test_intent\")\r\n\r\ntest_bot.opt.create_intent(test_intent)\r\n\r\n# reload the intent from the server. \r\n# This is required to get the intent's id from the server.\r\ntest_intent.reload() \r\n```\r\n\r\nOr find an existing one by name\r\n```python\r\ntest_intent = test_bot.opt.find_intent_with_name(\"test_intent\")\r\n```\r\n\r\nnotice that the 'opt' property is used when you want to do something with the bot that is related to Botnoi Dev Platform (eg. create_intent, find_intents, etc.). This is the standard for all data types that can directly interact with the server (eg. Bot, Intent, Object, etc.).\r\n\r\nYou can train the intent by adding some keywords(inputs) and reactions(outputs) to it\r\n```python\r\ntest_intent.opt.train_keyword(IntentKeyword(\"hello\"))\r\n\r\ntest_intent.opt.train_reaction(IntentReaction([\"hello!\", \"it works!\"]))\r\n```\r\n\r\nOr train the reaction with more complex actions like this\r\n```python\r\ntest_intent.opt.train_reaction(\r\n IntentReaction([\r\n Action.image(\"test_image\"), # send an image with name \"test_image\"\r\n Action.createParameter(parameterName=\"test_param\", parameterValue=Action.get_keyword()), # create a parameter to store the latest message from the user\r\n Action.text(\"test param is \" + Action.parameter(\"test_param\")), # get the parameter and use it in a text,\r\n ])\r\n)\r\n```\r\n\r\n## Create an object\r\nCreating objects is similar to creating intents. First, create an Object instance with typed objects in its objects property (eg. ApiObject, ImageObject, ButtonObject etc.). Every typed object instances must be of the same type. Then, you can add the Object instance to the bot.\r\n```python\r\ntest_image_object = Object(\r\n objectName=\"test_image\",\r\n objects=[\r\n ImageObject(\r\n original_url=\"https://console.botnoi.ai/assets/botnoi-logo/botnoi.svg\",\r\n preview_image_url=\"https://console.botnoi.ai/assets/botnoi-logo/botnoi.svg\",\r\n )\r\n ]\r\n)\r\n\r\ntest_bot.opt.create_object(test_image_object)\r\n```\r\n\r\nOr find an existing one by name\r\n```python\r\ntest_image_object = test_bot.opt.find_object_with_name(\"test_image\",type=ObjectType.image())\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A programatical alternative to the visual chatbot builder provided by https://botnoi.ai .",
"version": "0.0.8",
"project_urls": null,
"split_keywords": [
"botnoi",
"chatbot",
"bot",
"botnoi dev platform"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c881244e58720aceab7ff7715bb0d803b3928a03dc27833ef3a0fde65e400c37",
"md5": "13fcab109418e90f250e08a433d314f3",
"sha256": "9e3c25ab855a10546761748b9dd32f39531922db93e8e5dec36257a91758fdec"
},
"downloads": -1,
"filename": "BotnoiDevPlatform-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "13fcab109418e90f250e08a433d314f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 25973,
"upload_time": "2023-12-19T13:38:57",
"upload_time_iso_8601": "2023-12-19T13:38:57.295646Z",
"url": "https://files.pythonhosted.org/packages/c8/81/244e58720aceab7ff7715bb0d803b3928a03dc27833ef3a0fde65e400c37/BotnoiDevPlatform-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "94605c869235b2c6153ab76e2c3ff00fcbb38e29aba3f8a8555ce71dd9b9ebeb",
"md5": "0427ddac1b7837afb79bcfad046b4026",
"sha256": "1e388d986af2c6ee8fd5bfbe430c52443020c8a7ad74063d26764b0d3bbeb7e3"
},
"downloads": -1,
"filename": "BotnoiDevPlatform-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "0427ddac1b7837afb79bcfad046b4026",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16800,
"upload_time": "2023-12-19T13:38:59",
"upload_time_iso_8601": "2023-12-19T13:38:59.176548Z",
"url": "https://files.pythonhosted.org/packages/94/60/5c869235b2c6153ab76e2c3ff00fcbb38e29aba3f8a8555ce71dd9b9ebeb/BotnoiDevPlatform-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-19 13:38:59",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "botnoidevplatform"
}