Talos chatops framework
Project description
The TALOS framework
ChatOps made easy
About
With talosbot, you will be able to build operational bots without having to struggle with chat APIS or artifical intelligence, just focus in your tasks, aka skills, that are just functions with a return with the message that will be sent back.
The framework has been implemented to be easy to use and extend any components if you need some custom experience.
Components
A bot is made of 3 main independent components:
Channel
Deals with the messaging through a specific communication channel.
Matcher
Matches a received sentence to an similar example sentence associated to the skill.
Parser
The only optional component, will extract what are considered parameters inside a user sentence and make them available to the skill function without having to struggle parsing the sentence by yourself in the skill.
Built-in models
You have available a built in model that is executed locally so no info is sent to third parties.
Matcher model
BertMatcher: It uses sentence-transformers library to perform a cosine similarity.
NER Parser
NERParser: It uses a Spacy pipeline with the NER component with a default en_core_web_lg downloaded model that you can change by another one when executing a training task with the talos cli (read below for more info).
Workflow overview
- A user calls the bot with a sentence in some communication channel, like a telegram group
- The bot instance receives this sentence and performs the matching operation against all the available sentences
- If a parser is configured, will extract all the parameters from the sentence and they will be available in a dictionary
- The skill is executed and a message is sent back with the contents of the return in the skill.
Quickstart
Install the framework with your favorite virtualenv manager, the install command is:
pip install talosbot
Then create a bot.py file with for example:
from talosbot.matchers.bert import BertMatcher
from talosbot.parsers.ner import NERParser
from talosbot.channels.cli import CLIChannel
from talosbot.talos import Bot
channel = CLIChannel()
matcher = BertMatcher(acceptance_threshold=0.6)
parser = NERParser(getenv('MODEL_PATH', './ner_model'))
bot = Bot(matcher=matcher, parser=parser, channel=channel)
@bot.match('Execute the job XXX in the project some/repository', ('PROJECT', 'JOB'))
def check_pipeline(JOB, PROJECT):
return f"Checking pipeline {JOB} for project {PROJECT}..."
@bot.default_match()
def no_skill():
return 'No skill, my bad!'
if __name__ == '__main__':
bot.run()
This will start a dummy CLI communication interactive channel so you can test it, notice that for the NER parser, you will need to load a pretrained model to identify your own entities. You can download a pretrained model here.
If you want to train a new NER model, you can use the talos cli with your own dataset with:
talos trainer --trainingset data.json --output ner_model
Or train from a specific Spacy model
talos trainer --trainingset data.json --output ner_model/ --model en_core_web_lg
In the pretrained models repository you will find some data.json examples with the expected format.
For more examples, take a look at the examples directory on this project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file talosbot-0.1.1.tar.gz.
File metadata
- Download URL: talosbot-0.1.1.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
755b50cb71bcdbec4d8442b917c0b23a586acf7c0bd1302f3a0fccdb257249d3
|
|
| MD5 |
c8a25de77b0ba49f1c9b96218b84132c
|
|
| BLAKE2b-256 |
e40f4fdd6cad8f278f34911952b03bcf4b1938461ecc4d946e9c337658895976
|
File details
Details for the file talosbot-0.1.1-py3-none-any.whl.
File metadata
- Download URL: talosbot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d70dd5be0916ed60967bb479fbacf3d04855b44c49f87352d7277c6aa7016f15
|
|
| MD5 |
3c2f716e876fcc0dcaf278d3fcba7e7a
|
|
| BLAKE2b-256 |
c4e2cbe1965634d7cb2471934e0f9f374c808da85a7569de8a1f63adfe82a8a5
|