Your first Hello World

Apr 6, 2023

GlueML is an innovative tool that simplifies the development and deployment of machine learning-powered APIs. In this blog post, we will walk you through the process of getting started with GlueML using a simple YAML file. By following these steps, you'll be able to define your API's behavior and test it using a cURL request.

For this Hello World example we are going to define an API that answers a simple question with one input parameter and one output parameter.

Step 1: Write the GlueML YAML Configuration File defining the API that you want to build. To begin, create a new file with the following content:

version: 0.1
input:
planet: string
output:
planet: string
prompt: 'What is the closest planet to {planet}?'
model: free

In this example, we define a GlueML configuration using YAML syntax. The configuration specifies the version, input and output parameters, a prompt for the API, and the model to be used. Feel free to modify these values according to your specific use case.

Step 2: Your YAML configuration file needs to be reachable by the GlueML servers. Save that GlueML Configuration file in any place where it can be accessed via a HTTP request. You can use any HTTP server or GitHub gist, for example: https://gist.github.com/ggarber/309a7d7eba314acb5ad6b2f6aa19ecee/raw/a01363850ff73731ac3caf8de244160193b394a4/gistfile1.txt

Step 3: Test the GlueML API. You can make a cURL request just passing the url where you hosted your configuration file in the Step 2 and any input parameters you defined in your configuration. Open your preferred terminal or command prompt and execute the following command:

curl https://api.glueml.com/?spec=https://gist.githubusercontent.com/ggarber/309a7d7eba314acb5ad6b2f6aa19ecee/raw/a01363850ff73731ac3caf8de244160193b394a4/gistfile1.txt -d '{ "planet": "earth" }'

In this command, we use cURL to make a POST request to the GlueML API endpoint. The spec parameter specifies the location of your configuration file . The -d flag is used to send the JSON payload, which in this case is '{ "planet": "earth" }'. Modify the payload values as needed.

The response from the GlueML API will contain the result of your API request, including the closest planet to the provided input. You can parse and utilize this response according to your application's requirements.

By following these simple steps, you can quickly get started with GlueML and leverage the power of machine learning in your API development process. The YAML configuration file allows you to define your API's behavior, and the cURL request helps you test it seamlessly. GlueML's user-friendly approach and simplified deployment process make it an excellent choice for organizations looking to harness the potential of ML-powered APIs. Start your journey with GlueML today and unlock new possibilities for your business.