Make your first AI Assistant in Python with just an intents.json file. No complex setup. No advanced coding. Just install, configure, and run!
π Features
β Simple setup using JSON-based intents
π§ Built-in NER (Named Entity Recognition) training
π AI prediction and response handling
π Easy to integrate into chatbots
π§ Installation
pip install pythonaibrain
π§ͺ Quick Start
Create an intents.json file like this:
{
"intents": [
{
"tag": "greeting",
"patterns": ["Hi", "Hello", "How are you?"],
"responses": ["Hello!", "Hi there!", "Greetings!"]
},
{
"tag": "goodbye",
"patterns": ["Bye", "See you", "Goodbye"],
"responses": ["Goodbye!", "Take care!", "See you soon!"]
}
]
}
Create your Python file:
`
from os import system
from pyai import Brain
brain = Brain("your/dataset/path/intents.json") # Enter Path of your dataset.
while True:
message = input('Message : ')
message_type = brain.predict_message_type(message)
if message_type == 'Question' or message_type == "Answer":
brain.pyai_say(brain.process_messages(message))
if message_type == "Shutdown":
system(message)
`
π¦ Project Links
π PyPI: https://pypi.org/project/pythonaibrain/1.0.1/
π GitHub: https://github.com/World-Of-Programming-And-Technology/PythonAI
π οΈ How It Works
NER Training: Tags patterns with named entities
Model Building: Learns from examples using deep learning
Prediction Engine: Returns the best matching response for input
β Trouble?
If you see an error like:
ValueError: num_samples should be a positive integer value, but got num_samples=0
Make sure your intents.json has at least one tag with non-empty patterns.
π License
LGPL-2.1 license β feel free to use, modify, and share!
Top comments (0)