News

Roll Your Own Open Source Virtual Assistant with Python

Are you a Python coder looking for a simple way to dip your toes into the artificial intelligence waters? A new open source virtual assistant project may be just what you're looking for.

Called Friday, and now on GitHub under an MIT license, the project headed by Isaac Luke Smith might not provide the functionality of Siri or Cortana and the like, but it promises a simple codebase for AI experimentation. Another attraction is the use of Python, known for its AI-friendliness.

While it doesn't implement its own AI system (something that's planned for the future), Friday's simple codebase would make understanding the logic behind any AI system easier to understand, Smith told ADTMag. "If someone was encouraged to learn AI, then Friday would be useful for providing an interface to their work, but their learning would primarily come from building systems for Friday," he said, noting that he didn't create the project with the express intent of serving as an introduction to AI.

For the nitty-gritty AI functionality, the project relies on the API.AI "conversational user experience platform," which provides the back-end analysis of user requests.

In addition to the simple codebase, Friday's listed features include:

  • Easy to use and flexible plug-in system.
  • Google's speech-to-text and text-to-speech system.
  • Support for Windows, Linux and OS/X.
  • Python 2 and 3 support.
  • Fully automated tests using the Travis CI build system.

As a brand-new project on GitHub, at version 0.3.4 as of Sunday, the project's functionality is still being fleshed out. The Sunday revision (only the second listed in the project's history) added Travis CI code testing and deployment capabilities, limited use from the command line and beefed-up documentation.

Future plans for the project include allowing the use of different front-ends to communicate with the assistant and possibly a choice of back-ends, such as the wit.ai "natural language for developers" platform.

Other planned features include more functionality without an Internet connection, asynchronous behavior and output plug-ins to provide responses via different output systems, such as GUI or text-to-speech.

It works on Windows, Linux and OS X and supports programming in both the Python 2 and Python 3 variants.

Known for its simplicity and readability, Python has become a go-to programming language for AI, machine learning and other scientific use.

One reason for this, according to an answer to a Quora question, is: "Python is practically pseudocode already, has loads of easily accessible AI libs and is used extensively for AI work in academia which only furthers it's use in that area."

Smith expounded on that notion. "What lends Python to AI programming in general, I believe, is two main attributes of the language that AI programmers find extremely useful," he told ADTmag. "The first is the simplicity of the language and the wealth of libraries that have been developed for the language. When working with Python for AI, you tend to need to test hypotheses often. You take a subset of data, train some system on that data and check to see that your hypothesis holds for the data. Python lends itself very well to this practice as you can quickly prototype code due to the simplicity of the language and the included interpreter.

"As an added bonus, because Python can interact with C libraries easily, performance-intensive sections of code can be rewritten in C, allowing there to be little difference in efficiency between pure C code and Python code interfacing with that C code while still maintaining the benefits of Python."

Smith said he started the project because of his interest in virtual assistants, but found his inspirations -- Google Now, Alexa, Siri, Cortana and so on -- to be very closed and static. "Only developers who work for these companies really understand how the assistants work under the hood, and it's primarily those developers that have the most control over how the assistant responds to input," he said. "They control how questions are answered, what services their assistants integrate with, how the assistant talks, everything that defines the assistant they have control over."

Furthermore, Smith found existing open source projects -- such as Mycroft and Sirius (now called Lucida) -- to be too complicated, with large codebases that take time for developers to understand. "So, my original idea was to take the idea of a virtual assistant and to simplify it as much as I could. What that idea eventually resulted in was a virtual assistant that was built on plug-ins and a community of developers who wanted a common, natural-language interface to various services in their lives."

Friday was posted to the Reddit programming site for discussion, and Smith said he was surprised by the reception and interest in the project, including site visits and GitHub stars.

"I really did not expect the project to be as well received as it has been," said Smith, a student at Indiana University - Purdue University Fort Wayne who has five other projects on GitHub. "I mostly felt that I would find it useful and that others might as well." Smith acknowledged there is much work to be done on the project in his Reddit post and welcomed ideas and contributions. So far, two other programmers have committed code to the project.

About the Author

David Ramel is the editor of Visual Studio Magazine.

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.