Tutorial: Program a virtual assistant with Python using JarvisAI

We've all heard about virtual assistants, either in movies, books or video games. They are those intelligent programs that simulate the thinking and speaking of a human but that can perform multiple actions just by asking them.

With advances in artificial intelligence in areas such as natural language processing, computer vision and data prediction we have gotten a little closer to creating these virtual assistants.

Although without being perfect, Currently there are ways to program them in a simple way so that they can perform basic actions such as opening a program through voice commands or giving you the weather.

In this tutorial we will teach you to program a virtual assistant with artificial intelligence using JarvisAI.


The virtual assistant that will be created in this tutorial will have the ability to obtain the weather forecast, interact with Windows applications, open websites, the date and more information.

It is capable of obtaining information from your computer's microphone and will also have the ability to display information either on the console or using the speaker..

Required packages

To have access to the basic modules of the virtual assistant, JarvisAI module must be installed, using the following command.

pip instalar JarvisAI

 Using the following example code you will be able to see a list of all the available functionalities:

The list of available basic functions is:

  1. mic_input
  2. text2speech
  3. shutdown
  4. website_opener
  5. send_mail
  6. tell_me_date
  7. tell_me_time
  8. launch_any_app
  9. weather
  10. news
  11. tell_me


All the necessary libraries must be imported and JarvisAI instantiated:

To convert text to speech the following function is used:

It will be necessary to obtain information directly from the microphone, for that we use the following code segment:

To obtain the state of the time we are going to use a regular expression, where if "weather" or "temperature" is found it means that the command tends to be the search for the weather, all this starting from the voice input by microphone.

A similar process is also carried out to access the news:

For information search functions, a connection is made to the Wikipedia API, with which the first 500 words, using the command "tell me about" you can execute the following code:

For more basic functions of access to the time and date you can use the following code:

If you want a page to be opened using only voice commands, for example: Google o youtube, you just have to use the following code:

If you need help getting examples of the list of available voice commands, the following code snippet can be of great help:

Complete Code

If you want to support the creator of Jarvis AI, you can go to the following repository:

Follow Facialix on all his social networks:

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × 5 =