Luna A.I. is a chatbot powered by OpenAI's language model. It provides a conversational interface that allows users to interact with the chatbot through speech recognition or text input. The chatbot can perform various tasks such as opening websites, retrieving weather information, translating text, generating AI responses, and more.
Before running the chatbot script, make sure you have the following dependencies installed:
- Speech Recognition:
pip install SpeechRecognition
- Pyttsx3:
pip install pyttsx3
- requests:
pip install requests
You also need to provide your own OpenAI API key in the code (api_key = " INSERT YOUR OPENAI API-KEY HERE ") to utilize the OpenAI language model.
To use Luna A.I. chatbot, follow these steps:
- Clone the repository or download the script file (chatbot.py).
- Install the required dependencies mentioned in the "Requirements" section.
- Open the script file in a Python IDE or text editor.
- Replace the placeholder API key with your own OpenAI API key (api_key = "YOUR_OPENAI_API_KEY").
- Save the changes to the script file.
- Run the script in your Python environment.
- The chatbot will greet you and wait for your input. You can either speak your query or type it in the console.
- Speak or type your query, and Luna A.I. will respond accordingly.
- The chatbot supports various commands and functionalities. Refer to the code comments or the code explanation section for details on available commands and functionalities.
- To stop the chatbot, you can say or type "stop".
Speech recognition: The chatbot uses the SpeechRecognition library to listen to user input through a microphone and convert it into text.
Text-to-speech conversion: The chatbot utilizes the pyttsx3 library to convert its responses into speech, providing an interactive conversational experience.
OpenAI integration: The chatbot leverages OpenAI's language model to generate responses based on user input and previous conversations stored in an SQLite database.
Web browsing: The chatbot can open websites such as YouTube, Wikipedia, and Google based on user commands.
Weather information: By providing a city name, the chatbot can retrieve the current weather conditions using the WeatherAPI.
Translation: The chatbot can translate text to different languages using the Google Translate API.
System operations: The chatbot can perform system operations like opening applications, accessing settings, and even shutting down the computer.
The chatbot stores chat history in an SQLite database file named chat_history.db. Conversations are saved in a table called conversations with columns for user input and bot response.
The reset_chat() function can be used to delete all chat history from the database, and retrieve_chat() function can be used to retrieve and display previous conversations.
#Disclaimer Luna A.I. is an open-source project developed for educational purposes. It's important to note that the chatbot's functionality heavily relies on external APIs, and proper API keys or credentials should be obtained and used for accessing those services. Use this project responsibly and ensure compliance with the terms and conditions of the utilized APIs.
Feel free to customize and modify the chatbot according to your specific requirements and needs.
Contributions are welcome! If you have any suggestions, bug fixes, or improvements, please open an issue or submit a pull request to contribute to the project.
Special thanks to OpenAI for providing the powerful language model and to the developers of the libraries and APIs used in this project for their contributions.
For any inquiries or questions, please contact
Happy chatting with Luna A.I.!