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
import merlin
from merlin.model import ModelType

# Connect to an existing Merlin deployment

# 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

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.

googleClient, _ := google.DefaultClient(context.Background(), "")

cfg := client.NewConfiguration()
cfg.BasePath = ""
cfg.HTTPClient = googleClient

apiClient := client.NewAPIClient(cfg)

Last updated