Python Final
Python Final
MUMBAI
A Project Report
On
“AI Powered ChatBot”
DIPLOMA
In
COMPUTER ENGINEERING
Submitted by
Certificate
This is to certify that the following students of VI semester of Diploma in
COMPUTER ENGINEERING of Institute SANT GAJANAN MAHARAJ RURAL
POLYTECHNIC MAHAGAON-416503 (CODE-0965) has completed
Micro-project on “AI Powered ChatBot” satisfactory in subject Programming
with python subject code 22616 for academic year 2024 to 2025 as prescribed in
the curriculum.
ROLL
ENROLLMENT NO. SEAT NO. STUDENT NAME
NO.
2
AI Powered ChatBot Using Python
INDEX
1 Introduction
1
4 Program
7-9
5 Output
10-11
6 Conclusion, Reference
12
3
SGMRP Mahagaon
AI Powered ChatBot Using Python
Introduction
Python is a versatile programming language that allows developers to create a wide range of
applications, from simple scripts to complex software solutions. Tkinter, a built-in Python
module, provides an easy way to build graphical user interfaces (GUIs) for desktop applications.
In this tutorial, we will be using Tkinter to build an AI-powered chatbot with basic
functionalities such as sending and receiving messages. The chatbot will leverage the Mistral
API to generate intelligent responses, creating a conversational experience that feels natural and
interactive.
This chatbot project in Python is a great way to learn how to work with APIs, multi-threading,
and GUI development, while creating a practical and engaging application that you can use for
various purposes.
1
SGMRP Mahagaon
AI Powered ChatBot Using Python
The primary aim of this AI-powered chatbot is to provide a real-time, interactive conversational
interface that leverages the Mistral AI API to generate intelligent and context-aware responses.
Built with Python and Tkinter, it offers a user-friendly GUI where users can input queries and
receive streamed AI-generated replies seamlessly.
2
SGMRP Mahagaon
AI Powered ChatBot Using Python
The AI-powered chatbot is an essential tool for enhancing user engagement and automating
interactions across various digital platforms. By leveraging advanced and machine learning
(ML) techniques, this chatbot enables seamless communication between users and machines,
improving efficiency and accessibility.
This Python project focuses on creating an intelligent, real-time chatbot using frameworks like
Tkinter for the user interface and APIs such as Mistral AI for AI-driven responses. It ensures
dynamic and context-aware conversations while maintaining a user-friendly experience.
2. Operating System
3. Window 11
3
SGMRP Mahagaon
AI Powered ChatBot Using Python
1.0 Rationale :-
This microproject focuses on creating a basic AI-powered chatbot using Python, integrated with the
mistral-small API. The chatbot leverages the Mistral language model to generate intelligent and
context-aware responses to user queries. The goal is to explore how large language models
(LLMs) can be used to simulate human-like conversations with minimal setup. By using
Mistral’s lightweight yet powerful model, this project offers an efficient and cost-effective way
to experiment with AI-driven chat systems. It also provides hands-on experience with API
integration, prompt handling, and response processing, laying the foundation for more advanced
AI applications.
The primary aim of this AI-powered chatbot is to provide a real-time, interactive conversational
interface that leverages the Mistral AI API to generate intelligent and context- aware
responses. Built with Python and Tkinter, it offers a user-friendly GUI where users can input
queries and receive streamed AI-generated replies seamlessly.
4
SGMRP Mahagaon
AI Powered ChatBot Using Python
Sr.
NoName of Resource/Material Specification Qyt Remarks
5
SGMRP Mahagaon
AI Powered ChatBot Using Python
The AI-powered chatbot is an essential tool for enhancing user engagement and automating
interactions across various digital platforms. By leveraging advanced machine learning
(ML) techniques, this chatbot enables seamless communication between users and
machines, improving efficiency and accessibility.
This Python project focuses on creating an intelligent, real-time chatbot using frameworks
like Tkinter for the user interface and APIs such as Mistral AI for AI-driven responses. It
ensures dynamic and context-aware conversations while maintaining a user-friendly
experience.
6.0 Acknowledgement:-
We would like to express our sincere gratitude to everyone who contributed to the completion
of this notepad micro project in Python.
First and foremost, we extend our appreciation to the Python programming community for
providing valuable resources, documentation, and support throughout the development
process. Special thanks to the developers of Python and its libraries for creating such a
versatile and powerful programming language.
We are also grateful to the authors of relevant tutorials, articles, and online forums that helped
us understand and implement various concepts and features, including file handling, user
input/output, and basic GUI development in Python.
7.0 Features:-
User-Friendly Interface
Message Streaming
Security Features
6
SGMRP Mahagaon
AI Powered ChatBot Using Python
8.0 Program:-
import json
import tkinter as tk
from tkinter import scrolledtext, font
import requests
import os import
threading
try:
response = requests.post(API_URL, json=data, headers=headers, stream=True)
response.raise_for_status()
chat_window.config(state=tk.NORMAL)
chat_window.insert(tk.END, "Bot: ", "bot")
chat_window.config(state=tk.DISABLED)
7
SGMRP Mahagaon
AI Powered ChatBot Using Python
chat_window.config(state=tk.DISABLED)
chat_window.yview(tk.END)
except json.JSONDecodeError as e:
print(f"JSONDecodeError: {e}")
chat_window.config(state=tk.NORMAL)
chat_window.insert(tk.END, "\n")
chat_window.config(state=tk.DISABLED)
chat_window.yview(tk.END)
except requests.exceptions.RequestException as e:
chat_window.config(state=tk.NORMAL)
chat_window.insert(tk.END, f"Bot: Error: {str(e)}\n",
"bot") chat_window.config(state=tk.DISABLED)
chat_window.yview(tk.END)
except Exception as e:
chat_window.config(state=tk.NORMAL)
chat_window.insert(tk.END, f"Bot: Error: {str(e)}\n",
"bot") chat_window.config(state=tk.DISABLED)
chat_window.yview(tk.END)
def send_message():
user_input = user_entry.get()
if user_input.strip() != "":
chat_window.config(state=tk.NORMAL)
chat_window.insert(tk.END, f"You: {user_input}\n",
"user") chat_window.config(state=tk.DISABLED)
chat_window.yview(tk.END)
user_entry.delete(0, tk.END)
def on_enter_pressed(event):
send_message()
root = tk.Tk()
root.title("AI Powered Chatbot")
root.geometry("400x600")
root.configure(bg="#ECE5DD")
8
SGMRP Mahagaon
AI Powered ChatBot Using Python
root.bind('<Return>', on_enter_pressed)
9
SGMRP Mahagaon
AI Powered ChatBot Using Python
9.0 Output:-
10
SGMRP Mahagaon
AI Powered ChatBot Using Python
11
SGMRP Mahagaon
AI Powered ChatBot Using Python
Conclusion:-
In conclusion, we are proud of the accomplishments achieved through this notepad micro project
and remain enthusiastic about exploring new avenues for growth and innovation in Python
programming.
Through this project, we have successfully implemented a functional text editor that allows users to
create, open, edit, and save text files. We have explored essential concepts such as file handling, user
input/output, and basic GUI development, gaining hands-on experience in these fundamental areas of
programming.
Reference :-
https://www.w3schools.com/python/
https://www.officeclip.com/
https://chatgpt.com
12
SGMRP Mahagaon