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)