Path parameters

  • model_idstring Required

    The unique identifier of the trained model.

Query parameters

  • timeoutstring

    Controls the amount of time to wait for inference results.

    Values are -1 or 0.

application/json

BodyRequired

  • docsarray[object] Required

    An array of objects to pass to the model for inference. The objects should contain a fields matching your configured trained model input. Typically, for NLP models, the field name is text_field. Currently, for NLP models, only a single value is allowed.

    Hide docs attribute Show docs attribute object
    • *object Additional properties
  • Hide inference_config attributes Show inference_config attributes object
    • Hide regression attributes Show regression attributes object
    • Hide classification attributes Show classification attributes object
      • Specifies the number of top class predictions to return. Defaults to 0.

      • Specifies the maximum number of feature importance values per document.

      • Specifies the type of the predicted field to write. Acceptable values are: string, number, boolean. When boolean is provided 1.0 is transformed to true and 0.0 to false.

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

      • Specifies the field to which the top classes are written. Defaults to top_classes.

    • Hide text_classification attributes Show text_classification attributes object
      • Specifies the number of top class predictions to return. Defaults to 0.

      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

      • Classification labels to apply other than the stored labels. Must have the same deminsions as the default configured labels

    • Hide zero_shot_classification attributes Show zero_shot_classification attributes object
      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

      • Update the configured multi label option. Indicates if more than one true label exists. Defaults to the configured value.

      • labelsarray[string] Required

        The labels to predict.

    • fill_maskobject
      Hide fill_mask attributes Show fill_mask attributes object
      • Specifies the number of top class predictions to return. Defaults to 0.

      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

    • nerobject
      Hide ner attributes Show ner attributes object
      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

    • Hide pass_through attributes Show pass_through attributes object
      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

    • Hide text_embedding attributes Show text_embedding attributes object
      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

    • Hide text_expansion attributes Show text_expansion attributes object
      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

    • Hide question_answering attributes Show question_answering attributes object
      • questionstring Required

        The question to answer given the inference context

      • Specifies the number of top class predictions to return. Defaults to 0.

      • Hide tokenization attributes Show tokenization attributes object
        • truncatestring

          Values are first, second, or none.

        • spannumber

          Span options to apply

      • The field that is added to incoming documents to contain the inference prediction. Defaults to predicted_value.

      • The maximum answer length to consider for extraction

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • inference_resultsarray[object] Required
      Hide inference_results attributes Show inference_results attributes object
      • entitiesarray[object]

        If the model is trained for named entity recognition (NER) tasks, the response contains the recognized entities.

        Hide entities attributes Show entities attributes object
      • Indicates whether the input text was truncated to meet the model's maximum sequence length limit. This property is present only when it is true.

      • predicted_valuenumber | string | boolean | null | array[number | string | boolean | null] | array[number | string | boolean | null | array]

        If the model is trained for a text classification or zero shot classification task, the response is the predicted class. For named entity recognition (NER) tasks, it contains the annotated text output. For fill mask tasks, it contains the top prediction for replacing the mask token. For text embedding tasks, it contains the raw numerical text embedding values. For regression models, its a numerical value For classification models, it may be an integer, double, boolean or string depending on prediction type

      • For fill mask tasks, the response contains the input text sequence with the mask token replaced by the predicted value. Additionally

      • Specifies a probability for the predicted value.

      • Specifies a confidence score for the predicted value.

      • top_classesarray[object]

        For fill mask, text classification, and zero shot classification tasks, the response contains a list of top class entries.

        Hide top_classes attributes Show top_classes attributes object
      • warningstring

        If the request failed, the response contains the reason for the failure.

      • feature_importancearray[object]

        The feature importance for the inference results. Relevant only for classification or regression models

        Hide feature_importance attributes Show feature_importance attributes object
POST /_ml/trained_models/{model_id}/_infer
curl \
 --request POST 'http://api.example.com/_ml/trained_models/{model_id}/_infer' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"docs":[{"additionalProperty1":{},"additionalProperty2":{}}],"inference_config":{"regression":{"results_field":"string","num_top_feature_importance_values":42.0},"classification":{"num_top_classes":42.0,"num_top_feature_importance_values":42.0,"prediction_field_type":"string","results_field":"string","top_classes_results_field":"string"},"text_classification":{"num_top_classes":42.0,"tokenization":{"truncate":"first","span":42.0},"results_field":"string","classification_labels":["string"]},"zero_shot_classification":{"tokenization":{"truncate":"first","span":42.0},"results_field":"string","multi_label":true,"labels":["string"]},"fill_mask":{"num_top_classes":42.0,"tokenization":{"truncate":"first","span":42.0},"results_field":"string"},"ner":{"tokenization":{"truncate":"first","span":42.0},"results_field":"string"},"pass_through":{"tokenization":{"truncate":"first","span":42.0},"results_field":"string"},"text_embedding":{"tokenization":{"truncate":"first","span":42.0},"results_field":"string"},"text_expansion":{"tokenization":{"truncate":"first","span":42.0},"results_field":"string"},"question_answering":{"question":"string","num_top_classes":42.0,"tokenization":{"truncate":"first","span":42.0},"results_field":"string","max_answer_length":42.0}}}'