Product Selector

Fusion 5.12
    Fusion 5.12

    ML Model APIFusion Machine Learning Model API

    Table of Contents

    The Machine Learning (ML) Model service is a model prediction API for MLeap/Spark-ML models, as well as pass-through to Seldon Core-based models. Use this API to list the deployed ML models in Fusion and generate predictions.

    For more information, view the API specification.

    Examples

    Get the list of deployed models
    curl -u USERNAME:PASSWORD https://FUSION_HOST/api/ai/ml-models

    Response:

    {
        "models": [
            {
                "model_id": "lucidworks-sentiment",
                "type": "mleap",
                "last_modified": "2024-09-13T19:43:20Z"
            },
            {
                "model_id": "opennlp",
                "type": "open-nlp",
                "last_modified": "2024-09-13T19:43:15Z"
            },
            {
                "model_id": "sentiment-reviews",
                "type": "seldon",
                "last_modified": "2024-09-13T20:29:05Z"
            }
        ]
    }
    Check that a deployed model is working
    curl -u USERNAME:PASSWORD -X POST https://FUSION_HOST/api/ai/ml-models/sentiment-reviews/prediction \
    -d '{"text": "Hello world.  How are you doing today?"}'

    Response:

    {
        "score": [
            "0.8543054461479187"
        ],
        "label": [
            "positive"
        ],
        "_rawJsonResponse": "{\n  \"names\": [\"label\", \"score\", \"tokens\", \"attention_weights\"],\n  \"ndarray\": [[\"positive\"], [\"0.8543054461479187\"]]\n}"
    }

    A 500 server error indicates that either the model is not properly deployed, the model ID is wrong, or the input fields are wrong.

    Additional resources

    Lucidworks offers free training to help you get started with Fusion. Check out the Machine Learning Demystified course, which focuses on key concepts in machine learning, plus the available Fusion machine learning jobs and pipeline stages:

    Machine Learning Demystified

    Visit the LucidAcademy to see the full training catalog.