7
7
8
8
import static org .opensearch .core .xcontent .XContentParserUtils .ensureExpectedToken ;
9
9
import static org .opensearch .ml .common .CommonValue .TENANT_ID_FIELD ;
10
- import static org .opensearch .ml .common .CommonValue .VERSION_2_19_0 ;
11
10
import static org .opensearch .ml .common .utils .StringUtils .getParameterMap ;
12
11
13
12
import java .io .IOException ;
14
13
import java .util .ArrayList ;
15
14
import java .util .List ;
16
15
import java .util .Map ;
17
16
18
- import org .opensearch .Version ;
19
17
import org .opensearch .core .common .io .stream .StreamInput ;
20
18
import org .opensearch .core .common .io .stream .StreamOutput ;
21
19
import org .opensearch .core .common .io .stream .Writeable ;
22
20
import org .opensearch .core .xcontent .ToXContentObject ;
23
21
import org .opensearch .core .xcontent .XContentBuilder ;
24
22
import org .opensearch .core .xcontent .XContentParser ;
25
- import org .opensearch .ml .common .CommonValue ;
26
23
27
24
import lombok .Builder ;
28
25
import lombok .Data ;
@@ -42,8 +39,6 @@ public class MLCreatePromptInput implements ToXContentObject, Writeable {
42
39
public static final String PROMPT_FIELD_USER_PROMPT = "user" ;
43
40
public static final String PROMPT_FIELD_SYSTEM_PROMPT = "system" ;
44
41
45
- private static final Version MINIMAL_SUPPORTED_VERSION_FOR_CLIENT_CONFIG = CommonValue .VERSION_2_13_0 ;
46
-
47
42
private String name ;
48
43
private String description ;
49
44
private String version ;
@@ -105,13 +100,12 @@ public MLCreatePromptInput(
105
100
* @throws IOException thrown if an I/O exception occurred while reading the object from StreamInput
106
101
*/
107
102
public MLCreatePromptInput (StreamInput input ) throws IOException {
108
- Version streamInputVersion = input .getVersion ();
109
103
this .name = input .readOptionalString ();
110
104
this .description = input .readOptionalString ();
111
105
this .version = input .readOptionalString ();
112
106
this .prompt = input .readMap (s -> s .readString (), s -> s .readString ());
113
107
this .tags = input .readOptionalStringList ();
114
- this .tenantId = streamInputVersion . onOrAfter ( VERSION_2_19_0 ) ? input .readOptionalString () : null ;
108
+ this .tenantId = input .readOptionalString ();
115
109
}
116
110
117
111
/**
@@ -122,15 +116,12 @@ public MLCreatePromptInput(StreamInput input) throws IOException {
122
116
*/
123
117
@ Override
124
118
public void writeTo (StreamOutput output ) throws IOException {
125
- Version streamOutputVersion = output .getVersion ();
126
119
output .writeOptionalString (name );
127
120
output .writeOptionalString (description );
128
121
output .writeOptionalString (version );
129
122
output .writeMap (prompt , StreamOutput ::writeString , StreamOutput ::writeString );
130
123
output .writeCollection (tags , StreamOutput ::writeString );
131
- if (streamOutputVersion .onOrAfter (VERSION_2_19_0 )) {
132
- output .writeOptionalString (tenantId );
133
- }
124
+ output .writeOptionalString (tenantId );
134
125
}
135
126
136
127
/**
0 commit comments