Key Takeaways
- Developers can utilize services such as Wit.ai, Api.ai, Melissa, Clarifai, and TensorFlow to build artificial intelligence, chatbots and personal assistants for a variety of applications.
- Wit.ai, a service that provides voice recognition and machine learning for developers, is free for both public and private instances. It can convert verbal commands into text and can be trained to understand those commands.
- Api.ai, a chatbot API, offers machine learning capabilities and is one of the main ways to build conversational interfaces for Google’s Home platform. It also offers “Domains”, collections of knowledge and data structures ready for use in Api.ai agents.
- Melissa is an open source personal assistant that runs on Raspberry Pi, Windows, OS X and Linux, offering always-on voice control and a range of sample dialogues. Clarifai, on the other hand, is an AI service that can recognize image and video content.
- TensorFlow, an open source software library for numerical computation using data flow graphs, is an option for developers who want to build true artificial intelligence systems from scratch, offering the potential to train your own image recognition system or learning to do language processing.
The artificial intelligence, personal assistant and chatbot space has been growing rapidly. The idea of having a personal assistant you can beckon with the words “Siri”, “Alexa”, “Cortana” or “Ok Google” which connects us to the web and the ever growing Internet of Things (IoT) is becoming ever more commonplace. Almost every messenger program and smartphone OS have chatbots or personal assistants available in 2017! While their true level of “artificial intelligence” is debatable, we are witnessing the start of a world where we all have virtual assistants at our disposal!
Luckily for developers who want to get in on the action, there are a range of services available that make it simple to get started with the basics of building your own artificial intelligence, chatbot and/or personal assistant for whatever purpose you can dream up. Connect up your smart home, control a self made media center, deliver all sorts of information via a personal AI assistant… there are so many options available thanks to APIs and services. This lead up throughout 2015 and 2016 has made 2017 the year where developers have more options than ever before. Developers really can start building solutions of their own.
In this overview, we’ll look at the services that exist which can enable developers to begin connecting their own apps and IoT devices to voice recognition, chatbots and artificial intelligence throughout 2016.
Wit.ai
Wit.ai is a service which provides a nice combination of both voice recognition and machine learning for developers. It provides the service to convert verbal commands into text and can also be trained up in how to understand those commands. It also has a form of machine learning, where you can train it to understand commands which are said to it which it previously didn’t understand, however this isn’t an automatic process (it’s not a totally intelligent being yet!). Early in 2015, they joined Facebook and opened up the entire platform to be free for both public and private instances. Its development has been up and down since then, but the team have big plans for 2017.
Wit.ai has two main elements to it that you set up within your app — intents and entities. An intent is what action an instruction should take (e.g. turn on a light). An entity is a specific object or piece of information that our AI needs to know about to enact that intent (e.g. which light? Is it a smart light? Should it understand particular colors the light can switch to?). Rather than needing to create intents from scratch, Wit.ai also provides access to existing intents from the developer community which is quite neat!
Wit.ai also has the concept of “roles”, where it can learn to differentiate between entities in different contexts (e.g. numbers in different parts of an instruction can refer to different things – like an age, an order, a count). It also has some entity types built in that it can understand, such as temperature, URLs, emails, duration… etc.
A new feature in Wit.ai is the “Story” feature, which allows you to define typical conversations in a new way. You can set up the initial question, like “What’s the weather in Sydney?” and then define the steps and subsequent questions that the system should ask. It has the concept of “branches” which move the conversation in different ways if the system doesn’t get all the required information up front (e.g. if the user instead says “What’s the weather?”).
There is a Wit.ai API for developers of iOS, Android, Node.js, Raspberry Pi, Ruby, Python, C, Rust and Windows Phone. It even has a JavaScript plugin for front end developers.
Api.ai
Api.ai is a chatbot API which provides similar capabilities to Wit.ai, with intents and entities. It provides machine learning capabilities which can sometimes guess if someone uses a slightly different phrase than you’ve hardcoded into your assistant. They recently were purchased by Google in September 2016. It is now one of the main ways to build conversational interfaces for Google’s Home platform.
One key focus of Api.ai that differs from Wit.ai is its “Domains”. Domains are a whole collection of knowledge and data structures from Api.ai that are ready for use in every Api.ai agent (apps are called “agents” in Api.ai). Domains can include knowledge of common verbs and content types. As an example, it understands the different types of data that a request of “Book restaurant” needs, compared to “Book hotel”. It has a range of real information about encyclopedia-like topics such as history, word definitions, people of significance (e.g. celebrities, writers, characters), movies, stock prices and a lot more.
Api.ai is free to use but it is a little bit misleading on their website at the moment — it isn’t completely free as of 2016. Most of the “Domains” now require your account to be upgraded, however the price for this isn’t clear (developers will need to contact Api.ai’s sales team). Api.ai also still has a paid enterprise option which allows for the whole service to be run on a private cloud internally and more from their services team. This is potentially valuable if your usage needs to be totally private.
Api.ai has SDKs for Android, iOS, the Apple Watch, Node.js, Cordova, Unity, C++, Xamarin, Python and JavaScript. The Unity integration in particular might open this up to a range of additional platforms not listed above! It also can be integrated with Amazon’s Echo, Skype, Slack, Facebook Messenger, Microsoft’s Cortana and much more.
If you’d like to give Api.ai a try, I’ve got a series on getting started with Api.ai here at SitePoint. Just keep in mind that the domains have since required a paid account, so my example I put together doesn’t answer every question any longer as I don’t have a paid account.
Melissa
If you’d rather do more of the programming side of the AI yourself and you are a fan of Raspberry Pi, you could look into Melissa. Melissa is an open source personal assistant written in Python that runs on Raspberry Pi, Windows, OS X and Linux. It’s updated quite frequently and has quite a few who speak very highly of it!
Melissa has always-on voice control and has a range of sample dialogues out of the box, including things like taking notes, telling your horoscope, getting definitions from Wikipedia, playing music and more. For the Python developer who wants total control – Melissa might just be for you! To find out more and get full details on how it is put together, Tanay Pant, it’s main developer, has a whole book that covers it in more detail and serves as the detailed documentation for Melissa. I actually spoke with him all about Melissa at the start of the year. He’s done a lot of work on it!
Clarifai
One service from a completely different perspective is Clarifai, an artificial intelligence service that can recognize image and video content. It has its own deep learning engine that continuously improves with every use. If you are keen to take your AI prototype to a whole new level, why not give it the ability to see and recognize objects? It can do all sorts of things from tagging images, searching for other images that are visually similar and flagging inappropriate images. If you want to take it to the next level, you can even teach the platform entirely new concepts by training it with your own examples.
To integrate this into your own applications, Clarifai has both a REST API that could be integrated with your preferred language along with a Python, Java and Node.js API. Their service is free for up to 5000 uses a month. I’ve got a guide on using Clarifai here at SitePoint for those who’d like to give it a go — How to Make Your Web App Smarter with Image Recognition.
TensorFlow
If you are wanting to go beyond services which do a lot of the heavy lifting for you and really want to make true artificial intelligence systems from relative scratch, Google’s TensorFlow might be the option for you! While it’s something that will take longer to put together, you’ll learn a lot more about deep learning and artificial intelligence. TensorFlow is “an open source software library for numerical computation using data flow graphs”. It would be best for things like training your own image recognition system or learning to do language processing. You could also make conversational AI with TensorFlow that is trained on specific data, such as SpeakEasy AI which was a chatbot built on a neural model trained on millions of comments from Reddit.
There’s no limit to the sorts of things you could get a TensorFlow-powered program to do, this developer trained it to write new episodes of hit 90s show, Friends.
Conclusion
There are a range of services and APIs out there which can provide artificial intelligence, personal assistants, chatbots and more. You don’t need to be a computer science expert to implement some of the core basics in your own apps! Try out a few of the above and see what you can create. If you feel super confident, go straight for TensorFlow and make something seriously mindblowing.
If you do put together your own AI prototype using any of the above services, or you’ve had some experience with the above or a service I did not mention — please share it in the comments or get in touch with me on Twitter (@thatpatrickguy). I’d love to hear about it!
Frequently Asked Questions on Building Artificial Intelligence
What are the basic steps to build an AI system?
Building an AI system involves several steps. First, you need to define the problem you want the AI to solve. This involves understanding the business needs and setting clear objectives. Next, you need to collect and prepare the data. AI systems learn from data, so you need a large amount of relevant and high-quality data. Then, you need to choose the right AI model. There are many different types of AI models, and the right one depends on your specific problem. After that, you need to train the AI model using your data. This involves feeding the data into the model and adjusting the model’s parameters until it can accurately predict the desired outcome. Finally, you need to test and deploy the AI system. This involves checking the system’s performance and making any necessary adjustments.
What skills do I need to build an AI?
Building an AI requires a combination of skills. You need a strong understanding of computer science and programming. Languages like Python and R are commonly used in AI development. You also need a good understanding of mathematics and statistics, as these are the foundation of many AI algorithms. Additionally, knowledge of machine learning and neural networks is essential. Finally, domain knowledge can be very helpful. This is knowledge about the specific area where you want to apply AI, such as finance, healthcare, or marketing.
Can I build an AI without coding?
Yes, it is possible to build an AI without coding, thanks to various AI platforms and tools that offer drag-and-drop interfaces and pre-built models. These tools allow you to build AI models by visually arranging and connecting blocks that represent different functions or algorithms. However, these tools have their limitations and may not be suitable for more complex AI projects.
How long does it take to build an AI?
The time it takes to build an AI can vary greatly depending on the complexity of the project, the quality and quantity of the data, and the skills and resources available. A simple AI project might take a few weeks, while a complex one could take several months or even years.
How much does it cost to build an AI?
The cost of building an AI can vary widely depending on the scope of the project, the complexity of the AI, and the resources required. Costs can include data acquisition and preparation, software and hardware, development time, and ongoing maintenance and updates. It’s also important to consider the cost of hiring or training staff with the necessary skills.
What are the challenges in building an AI?
Building an AI comes with several challenges. One of the biggest is data. You need a large amount of high-quality data to train an AI, and collecting and preparing this data can be difficult and time-consuming. Another challenge is choosing the right AI model and tuning it to achieve the best performance. Finally, deploying and maintaining an AI in a real-world environment can be complex and requires ongoing effort.
What are the ethical considerations when building an AI?
When building an AI, it’s important to consider the ethical implications. This includes issues like privacy, fairness, and transparency. For example, you need to ensure that your AI respects user privacy and doesn’t use data inappropriately. You also need to ensure that your AI doesn’t discriminate or make unfair decisions. Finally, it’s important to make your AI transparent, so that users can understand how it works and how it makes decisions.
Can I build an AI on my own?
Yes, it is possible to build an AI on your own, especially if you have the necessary skills and resources. There are many online resources and tools that can help you learn about AI and get started with building your own AI. However, building an AI can be a complex and time-consuming process, so it can be helpful to work with a team or seek guidance from experts.
What are some common mistakes when building an AI?
Some common mistakes when building an AI include not defining the problem clearly, not having enough or good quality data, choosing the wrong AI model, overfitting the model to the training data, and not testing the AI thoroughly before deployment. It’s important to avoid these mistakes to ensure that your AI performs well and delivers the desired results.
How can I improve the performance of my AI?
There are several ways to improve the performance of your AI. One is to use more or better quality data. Another is to tune the parameters of your AI model to optimize its performance. You can also try different AI models to see which one works best for your specific problem. Finally, you can use techniques like ensemble learning, where you combine the predictions of multiple models to get a better result.
PatCat is the founder of Dev Diner, a site that explores developing for emerging tech such as virtual and augmented reality, the Internet of Things, artificial intelligence and wearables. He is a SitePoint contributing editor for emerging tech, an instructor at SitePoint Premium and O'Reilly, a Meta Pioneer and freelance developer who loves every opportunity to tinker with something new in a tech demo.