@@ -42,9 +42,11 @@ Controls the amount of time to wait for {infer} results. Defaults to 10 seconds.
42
42
[[infer-trained-model-request-body]]
43
43
== {api-request-body-title}
44
44
45
- `input`::
46
- (Required,string)
47
- The input text for evaluation.
45
+ `docs`::
46
+ (Required, array)
47
+ An array of objects to pass to the model for inference. The objects should
48
+ contain a field matching your configured trained model input. Typically, the field
49
+ name is `text_field`. Currently, only a single value is allowed.
48
50
49
51
////
50
52
[[infer-trained-model-deployment-results]]
@@ -66,24 +68,24 @@ text classification task, the response is the score. For example:
66
68
--------------------------------------------------
67
69
POST _ml/trained_models/model2/deployment/_infer
68
70
{
69
- "input ": " The movie was awesome!!"
71
+ "docs ": [{"text_field": " The movie was awesome!!"}]
70
72
}
71
73
--------------------------------------------------
72
74
// TEST[skip:TBD]
73
75
74
- The API returns scores in this case, for example:
76
+ The API returns the predicted label and the confidence.
75
77
76
78
[source,console-result]
77
79
----
78
80
{
79
- "positive " : 0.9998062667902223 ,
80
- "negative " : 1.9373320977752957E-4
81
+ "predicted_value " : "POSITIVE" ,
82
+ "prediction_probability " : 0.9998667964092964
81
83
}
82
84
----
83
85
// NOTCONSOLE
84
86
85
- For named entity recognition (NER) tasks, the response contains the recognized
86
- entities and their type. For example:
87
+ For named entity recognition (NER) tasks, the response contains the annotated
88
+ text output and the recognized entities.
87
89
88
90
[source,console]
89
91
--------------------------------------------------
@@ -94,21 +96,26 @@ POST _ml/trained_models/model2/deployment/_infer
94
96
--------------------------------------------------
95
97
// TEST[skip:TBD]
96
98
97
- The API returns scores in this case, for example :
99
+ The API returns in this case:
98
100
99
101
[source,console-result]
100
102
----
101
103
{
104
+ "predicted_value" : "Hi my name is [Josh](PER&Josh) and I live in [Berlin](LOC&Berlin)",
102
105
"entities" : [
103
106
{
104
- "label" : "person",
105
- "score" : 0.9988716330253505,
106
- "word" : "Josh"
107
+ "entity" : "Josh",
108
+ "class_name" : "PER",
109
+ "class_probability" : 0.9977303419824,
110
+ "start_pos" : 14,
111
+ "end_pos" : 18
107
112
},
108
113
{
109
- "label" : "location",
110
- "score" : 0.9980872542990656,
111
- "word" : "Berlin"
114
+ "entity" : "Berlin",
115
+ "class_name" : "LOC",
116
+ "class_probability" : 0.9992474323902818,
117
+ "start_pos" : 33,
118
+ "end_pos" : 39
112
119
}
113
120
]
114
121
}
0 commit comments