Models

Python SDK

The Merlin SDK can be installed directly using pip:

pip install merlin-sdk

Users should then be able to connect to a Merlin deployment as follows

getting_started.py
import merlin
from merlin.model import ModelType

# Connect to an existing Merlin deployment
merlin.set_url("merlin.example.com")

# Set the active model to the name given by parameter, if the model with the given name is not found, a new model will 
# be created.
merlin.set_model("example-model", ModelType.PYFUNC)

# Ensure that you're connected by printing out some Model Endpoints
merlin.list_model_endpoints()

Client Libraries

Merlin provides Go client library to deploy and serve ML models.

To connect to the Merlin deployment, the client needs to be authenticated by Google OAuth2. You can use google.DefaultClient() to get the Application Default Credential.

getting_started.go
googleClient, _ := google.DefaultClient(context.Background(), "https://www.googleapis.com/auth/userinfo.email")

cfg := client.NewConfiguration()
cfg.BasePath = "http://merlin.dev/api/merlin/v1"
cfg.HTTPClient = googleClient

apiClient := client.NewAPIClient(cfg)

Last updated