2828import org .opensearch .ml .common .transport .MLTaskResponse ;
2929import org .opensearch .ml .common .transport .prediction .MLPredictionTaskAction ;
3030import org .opensearch .ml .common .transport .prediction .MLPredictionTaskRequest ;
31- import org .opensearch .ml .common .utils .StringUtils ;
3231
3332import java .io .IOException ;
3433import java .security .AccessController ;
5150public class ModelGuardrail extends Guardrail {
5251 public static final String MODEL_ID_FIELD = "model_id" ;
5352 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 " ;
5554
5655 private String modelId ;
5756 private String responseFilter ;
@@ -67,7 +66,7 @@ public ModelGuardrail(String modelId, String responseFilter, String responseAcce
6766 this .responseAccept = responseAccept ;
6867 }
6968 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 ));
7170 }
7271
7372 public ModelGuardrail (StreamInput input ) throws IOException {
@@ -157,7 +156,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
157156 builder .field (RESPONSE_FILTER_FIELD , responseFilter );
158157 }
159158 if (responseAccept != null ) {
160- builder .field (RESPONSE_ACCEPT_FIELD , responseAccept );
159+ builder .field (RESPONSE_VALIDATION_REGEX_FIELD , responseAccept );
161160 }
162161 builder .endObject ();
163162 return builder ;
@@ -180,7 +179,7 @@ public static ModelGuardrail parse(XContentParser parser) throws IOException {
180179 case RESPONSE_FILTER_FIELD :
181180 responseFilter = parser .text ();
182181 break ;
183- case RESPONSE_ACCEPT_FIELD :
182+ case RESPONSE_VALIDATION_REGEX_FIELD :
184183 responseAccept = parser .text ();
185184 break ;
186185 default :
0 commit comments