28
28
import org .opensearch .ml .common .transport .MLTaskResponse ;
29
29
import org .opensearch .ml .common .transport .prediction .MLPredictionTaskAction ;
30
30
import org .opensearch .ml .common .transport .prediction .MLPredictionTaskRequest ;
31
- import org .opensearch .ml .common .utils .StringUtils ;
32
31
33
32
import java .io .IOException ;
34
33
import java .security .AccessController ;
51
50
public class ModelGuardrail extends Guardrail {
52
51
public static final String MODEL_ID_FIELD = "model_id" ;
53
52
public static final String RESPONSE_FILTER_FIELD = "response_filter" ;
54
- public static final String RESPONSE_ACCEPT_FIELD = "response_accept " ;
53
+ public static final String RESPONSE_VALIDATION_REGEX_FIELD = "response_validation_regex " ;
55
54
56
55
private String modelId ;
57
56
private String responseFilter ;
@@ -67,7 +66,7 @@ public ModelGuardrail(String modelId, String responseFilter, String responseAcce
67
66
this .responseAccept = responseAccept ;
68
67
}
69
68
public ModelGuardrail (@ NonNull Map <String , Object > params ) {
70
- this ((String ) params .get (MODEL_ID_FIELD ), (String ) params .get (RESPONSE_FILTER_FIELD ), (String ) params .get (RESPONSE_ACCEPT_FIELD ));
69
+ this ((String ) params .get (MODEL_ID_FIELD ), (String ) params .get (RESPONSE_FILTER_FIELD ), (String ) params .get (RESPONSE_VALIDATION_REGEX_FIELD ));
71
70
}
72
71
73
72
public ModelGuardrail (StreamInput input ) throws IOException {
@@ -157,7 +156,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
157
156
builder .field (RESPONSE_FILTER_FIELD , responseFilter );
158
157
}
159
158
if (responseAccept != null ) {
160
- builder .field (RESPONSE_ACCEPT_FIELD , responseAccept );
159
+ builder .field (RESPONSE_VALIDATION_REGEX_FIELD , responseAccept );
161
160
}
162
161
builder .endObject ();
163
162
return builder ;
@@ -180,7 +179,7 @@ public static ModelGuardrail parse(XContentParser parser) throws IOException {
180
179
case RESPONSE_FILTER_FIELD :
181
180
responseFilter = parser .text ();
182
181
break ;
183
- case RESPONSE_ACCEPT_FIELD :
182
+ case RESPONSE_VALIDATION_REGEX_FIELD :
184
183
responseAccept = parser .text ();
185
184
break ;
186
185
default :
0 commit comments