Introduction to the SDK
Learn to use the AI Hub SDK from the ground up, work through real examples, and build enough knowledge to continue exploring the SDK on your own.
Audience and prerequisites
-
You don’t need to know anything about the AI Hub SDK—you don’t even have to know what “SDK” stands for.
-
You need an AI Hub account at any license tier.
-
You need any text editor—even a basic one like TextEdit on macOS or Notepad on Windows.
-
Some familiarity with AI Hub concepts and terminology.
-
It helps to have basic familiarity with the Python programming language. If you know how to print things, create loops, and use
if
statements, you’re in good shape. Otherwise, any of these resources can help you learn the basics.-
Python Tutorial for Beginners on TechWorld with Nana’s YouTube channel
-
Learn Python 3 on codecademy.com
-
Python Basics on realpython.com
-
Introducing Python by Bill Lubanovic
-
Goals
This tutorial teaches you how to do these tasks.
- Decide whether to use the SDK or GUI to interact with AI Hub.
-
Install the AI Hub SDK.
-
Authorize the SDK to perform AI Hub operations.
-
Test the SDK to make sure it’s installed and authorized correctly.
-
Use the SDK to process documents with an AI Hub app.
-
Use the SDK to analyze a document with AI Hub.
-
Use the SDK to delete files left over from the two previous use cases.
What is an SDK?
“SDK” stands for “software development kit.” It’s a code library that you use to interact with software such as AI Hub.
Of course, you could just point a browser to aihub.instabase.com
and work through its graphical user interface (GUI). But the API and SDK give you more options. They let you use AI Hub programmatically, or via another computer program. The API and the SDK are more complicated than using the GUI, but also more flexible and powerful.
Analogy
-
Using the API is like driving a car with a manual transmission.
-
Using the SDK is like driving a car with an automatic transmission.
-
Using the GUI is like calling a taxi.
You arrive at the same place in each case, but some approaches take care of more details for you.
Why use the AI Hub SDK?
You know that the SDK is a tool for using AI Hub while bypassing the GUI. Why would you want to do that?
By allowing you to control AI hub through code instead of clicks, the SDK lets you build automated and repeatable workflows.
Imagine that your company collects hundreds of documents from its sales department every night. In the morning you process those documents with AI Hub and store the results in a CSV file for further processing by other systems.
Here’s one workflow you could use every morning:
-
Use your browser to log in to AI Hub.
-
Run the appropriate AI Hub app.
-
Upload files for the app to process.
-
Wait for the AI Hub app to finish.
-
View the results within AI Hub.
-
Export the results to a CSV file for further processing.
That’s a lot of steps and a lot of chances for human error.
By writing a program that uses the SDK to control AI Hub, you could run this one-step workflow every morning to get the same results without any human errors.
- Run your SDK-enabled program.
This one command is an ideal example of an automated and repeatable workflow.
Why Python?
The AI Hub SDK works only with the Python programming language. If you’re new to Python, you might wonder why Python was chosen instead of another popular language like Java or Go.
It’s because Python is:
-
Similar in structure and syntax to English and how many people think.
-
Easier to learn than most other languages.
-
Straightforward to understand and maintain.
-
Concise, so you can do a lot with just a few lines of code.
Consider these code snippets, which all display Hello, SDK user
.
Which language is easiest to understand? Which would you prefer to deal with if you were in charge of debugging code that someone else wrote?
Next steps
You now understand what an SDK is and why you might want to use an SDK instead of a GUI. The next page of this tutorial shows how to install and authorize the SDK on your computer.