ML Functional Services Inference (Deprecated)

Prepares a request message for the Leonardo Machine Learning Foundation (Leonardo ML Foundation) services.

It should be used with openAPI operators (check the example graph com.sap.ml.leonardo.mLFFunctionalServicesInference). The request is a POST request, and it can have three input formats: files, texts, and raw. When the Functional Service supports more than one, the option to choose is available (as type).

For example: Image Classification supports only files. As the input is always a message, the body will have the data itself. More specifically, the input message body will have either a path to an image or the serialized image. Each Functional Service also supports a set of configurations:
  • version

  • modelName

  • options

  • type

As the inputs, the configuration also varies according to the Functional Service. They can also be set by the header of each input message. Given a message in the texts input port:

header

body

{"options": "{"numSimilarVectors":1}"}

{"0": [{"id": "v0", "vector": [0.22, 0.93]}, {"id": "v1", "vector": [0.39, 0.69]}]}

The body will be used for the inference, and the options configuration will be set for this request as {\"numSimilarVectors\":1}.

For a raw input port an example would be:

header

body

{}

"{"sourceLanguage": "en", "targetLanguages": ["de"],"units": [{"value": "It is not possible to add products to the shopping cart."}]}"

Finally, for files input port message and example would be:

header

body

{}

/home/test/sample.jpg

Configuration Parameters

Name

ID

Type

Description

Functional Services

Functional Services

string

Mandatory. Functional service to be used (Image Classification, Image Feature Extraction, Image OCR, Nearest Neighbor Search, Similarity Scoring, Text Classifier, Topic Detection, Translation, Translation, Scene Text Recognition).

Default: ""

version

version

string

Defines which model version will be used.

Used by: Image Classification, Image Feature Extraction, Text Classifier

Default: ""

modelName

modelName

string

Defines which model will be used.

Used by: Image Classification, Image Feature Extraction, Text Classifier

Default: ""

options

options

object

Defines a JSON with the options for inference. Each functional service has its own options format and the user should correctly set it according to the documentation (the functional service is expected to provide its own set of options).

Used by: Image OCR, Similarity Scoring, Topic Detection

Default: ""

type

type

string

Defines the input format type. It is only present for services that support more than one type.

Used by: Similarity Scoring

Default: "texts"

Input

Input

Type

Description

input

message

A message whose body is the information to the POST inference request and header can set the configurations for the Functional Service. The input type can be set using the field type in the message header or configuration (both when it is supported by the service). They assume the following values:

  • raw: The body is the raw information sent to the POST inference request.

    Used by: Translation

  • texts: The body will be included as the values for the texts key on the form-data request.

    Used by: Text Classifier

  • files: The body will be included as the values for the files key on the form-data request.

    Used by: Image Classification, Image Feature Extraction, Image OCR, Similarity Scoring, Topic Detection, Translation, Scene Text Recognition.

Output

Output

Type

Description

output

message

The inference result as a JSON string, the format varies according to the service.