Prerequisites
- Install the Tensorlake SDK to build and deploy applications.
- Get an API key from the Tensorlake Dashboard.
Hello World
Applications are defined by writing Python functions. The entrypoint function has to be decorated with@api
decorator.
hello_world.py
Deploy Application
https://api.tensorlake.ai/v1/applications/hello_world
.
Calling Applications
Once you have deployed your application, it’s available as an HTTP endpoint. Making a request to your application will return a Request ID. You can use this Request ID to track the status of the request and get the output when your application is done processing the request.Get the Output of an Application
Once the application is complete, you can get the output of any function in your application. This is useful because often the intermediate stages of an application might have useful data that you want to use, or you might want them for debugging purposes.None
value in this case.
Generally, you would want to check if the request is complete before getting the output.
Test Applications
Applications can run locally on your laptop, so you can test them before deploying them to the cloud.hello_world.py
Building a Structured Extraction Application
Most real world applications will require python packages and access to secrets. For example, if you are building an application to extract personal information from Driving licenses using OpenAI’s structured output - you will need the OpenAI package, and your OpenAI API key.structured_extraction.py
OPENAI_API_KEY
secret to authenticate with OpenAI.
Building custom images allows you to install pretty much anything you want in your function. The Image
api allows running any commands, or other standard commands Docker allows.
The secrets
argument is used to specify the secrets that are available to the functions. These secrets have to be specified before the functions are deployed.
So lets deploy the secrets first, get your OpenAI API key and then run the following command:
Programming Guide
Learn more about customizing functions and compute resources for applications.
Dynamic Routing
Learn how to route data between functions dynamically during request processing.
Map-Reduce and Parallel Processing
Learn how to use map-reduce and parallel processing to process requests faster.
Images
Guide to building custom images for functions.