Skip to content

Commit 6de692b

Browse files
author
Max Hniebergall
committed
Remove endpoint_version
1 parent 8c9c4f4 commit 6de692b

File tree

115 files changed

+677
-2005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+677
-2005
lines changed

server/src/main/java/org/elasticsearch/inference/EndpointVersions.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/inference/InferenceService.java

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,9 @@ default void init(Client client) {}
3939
* @param modelId Model Id
4040
* @param taskType The model task type
4141
* @param config Configuration options including the secrets
42-
* @param endpointVersion
4342
* @param parsedModelListener A listener which will handle the resulting model or failure
4443
*/
45-
void parseRequestConfig(
46-
String modelId,
47-
TaskType taskType,
48-
Map<String, Object> config,
49-
EndpointVersions endpointVersion,
50-
ActionListener<Model> parsedModelListener
51-
);
44+
void parseRequestConfig(String modelId, TaskType taskType, Map<String, Object> config, ActionListener<Model> parsedModelListener);
5245

5346
/**
5447
* Parse model configuration from {@code config map} from persisted storage and return the parsed {@link Model}. This requires that
@@ -61,16 +54,9 @@ void parseRequestConfig(
6154
* @param taskType The model task type
6255
* @param config Configuration options
6356
* @param secrets Sensitive configuration options (e.g. api key)
64-
* @param endpointVersion
6557
* @return The parsed {@link Model}
6658
*/
67-
Model parsePersistedConfigWithSecrets(
68-
String modelId,
69-
TaskType taskType,
70-
Map<String, Object> config,
71-
Map<String, Object> secrets,
72-
EndpointVersions endpointVersion
73-
);
59+
Model parsePersistedConfigWithSecrets(String modelId, TaskType taskType, Map<String, Object> config, Map<String, Object> secrets);
7460

7561
/**
7662
* Parse model configuration from {@code config map} from persisted storage and return the parsed {@link Model}.
@@ -81,10 +67,9 @@ Model parsePersistedConfigWithSecrets(
8167
* @param modelId Model Id
8268
* @param taskType The model task type
8369
* @param config Configuration options
84-
* @param endpointVersion
8570
* @return The parsed {@link Model}
8671
*/
87-
Model parsePersistedConfig(String modelId, TaskType taskType, Map<String, Object> config, EndpointVersions endpointVersion);
72+
Model parsePersistedConfig(String modelId, TaskType taskType, Map<String, Object> config);
8873

8974
/**
9075
* Perform inference on the model.

server/src/main/java/org/elasticsearch/inference/ModelConfigurations.java

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public class ModelConfigurations implements ToFilteredXContentObject, VersionedN
3131
public static final String TASK_SETTINGS = "task_settings";
3232
public static final String PARAMETERS = "parameters";
3333
public static final String CHUNKING_SETTINGS = "chunking_settings";
34-
public static final String INCLUDE_PARAMETERS = "include_parameters";
35-
public static final String ENDPOINT_VERSION_FIELD_NAME = "endpoint_version";
3634
private static final String NAME = "inference_model";
3735

3836
public static ModelConfigurations of(Model model, TaskSettings taskSettings) {
@@ -45,8 +43,7 @@ public static ModelConfigurations of(Model model, TaskSettings taskSettings) {
4543
model.getConfigurations().getService(),
4644
model.getServiceSettings(),
4745
taskSettings,
48-
model.getConfigurations().getChunkingSettings(),
49-
model.getConfigurations().getEndpointVersion()
46+
model.getConfigurations().getChunkingSettings()
5047
);
5148
}
5249

@@ -60,8 +57,7 @@ public static ModelConfigurations of(Model model, ServiceSettings serviceSetting
6057
model.getConfigurations().getService(),
6158
serviceSettings,
6259
model.getTaskSettings(),
63-
model.getConfigurations().getChunkingSettings(),
64-
model.getConfigurations().getEndpointVersion()
60+
model.getConfigurations().getChunkingSettings()
6561
);
6662
}
6763

@@ -71,46 +67,36 @@ public static ModelConfigurations of(Model model, ServiceSettings serviceSetting
7167
private final ServiceSettings serviceSettings;
7268
private final TaskSettings taskSettings;
7369
private final ChunkingSettings chunkingSettings;
74-
private final EndpointVersions endpointVersion;
7570

7671
/**
7772
* Allows no task settings to be defined. This will default to the {@link EmptyTaskSettings} object.
7873
*/
79-
public ModelConfigurations(
80-
String inferenceEntityId,
81-
TaskType taskType,
82-
String service,
83-
ServiceSettings serviceSettings,
84-
EndpointVersions endpointVersion
85-
) {
86-
this(inferenceEntityId, taskType, service, serviceSettings, EmptyTaskSettings.INSTANCE, endpointVersion);
74+
public ModelConfigurations(String inferenceEntityId, TaskType taskType, String service, ServiceSettings serviceSettings) {
75+
this(inferenceEntityId, taskType, service, serviceSettings, EmptyTaskSettings.INSTANCE);
8776
}
8877

8978
public ModelConfigurations(
9079
String inferenceEntityId,
9180
TaskType taskType,
9281
String service,
9382
ServiceSettings serviceSettings,
94-
ChunkingSettings chunkingSettings,
95-
EndpointVersions endpointVersion
83+
ChunkingSettings chunkingSettings
9684
) {
97-
this(inferenceEntityId, taskType, service, serviceSettings, EmptyTaskSettings.INSTANCE, chunkingSettings, endpointVersion);
85+
this(inferenceEntityId, taskType, service, serviceSettings, EmptyTaskSettings.INSTANCE, chunkingSettings);
9886
}
9987

10088
public ModelConfigurations(
10189
String inferenceEntityId,
10290
TaskType taskType,
10391
String service,
10492
ServiceSettings serviceSettings,
105-
TaskSettings taskSettings,
106-
EndpointVersions endpointVersion
93+
TaskSettings taskSettings
10794
) {
10895
this.inferenceEntityId = Objects.requireNonNull(inferenceEntityId);
10996
this.taskType = Objects.requireNonNull(taskType);
11097
this.service = Objects.requireNonNull(service);
11198
this.serviceSettings = Objects.requireNonNull(serviceSettings);
11299
this.taskSettings = Objects.requireNonNull(taskSettings);
113-
this.endpointVersion = endpointVersion;
114100
this.chunkingSettings = null;
115101
}
116102

@@ -120,16 +106,14 @@ public ModelConfigurations(
120106
String service,
121107
ServiceSettings serviceSettings,
122108
TaskSettings taskSettings,
123-
ChunkingSettings chunkingSettings,
124-
EndpointVersions endpointVersion
109+
ChunkingSettings chunkingSettings
125110
) {
126111
this.inferenceEntityId = Objects.requireNonNull(inferenceEntityId);
127112
this.taskType = Objects.requireNonNull(taskType);
128113
this.service = Objects.requireNonNull(service);
129114
this.serviceSettings = Objects.requireNonNull(serviceSettings);
130115
this.taskSettings = Objects.requireNonNull(taskSettings);
131116
this.chunkingSettings = chunkingSettings;
132-
this.endpointVersion = endpointVersion;
133117
}
134118

135119
public ModelConfigurations(StreamInput in) throws IOException {
@@ -141,9 +125,6 @@ public ModelConfigurations(StreamInput in) throws IOException {
141125
this.chunkingSettings = in.getTransportVersion().onOrAfter(TransportVersions.ML_INFERENCE_CHUNKING_SETTINGS)
142126
? in.readOptionalNamedWriteable(ChunkingSettings.class)
143127
: null;
144-
this.endpointVersion = in.getTransportVersion().onOrAfter(TransportVersions.INFERENCE_API_PARAMATERS_INTRODUCED)
145-
? Objects.requireNonNullElse(in.readEnum(EndpointVersions.class), EndpointVersions.FIRST_ENDPOINT_VERSION)
146-
: EndpointVersions.FIRST_ENDPOINT_VERSION;
147128
}
148129

149130
@Override
@@ -156,9 +137,6 @@ public void writeTo(StreamOutput out) throws IOException {
156137
if (out.getTransportVersion().onOrAfter(TransportVersions.ML_INFERENCE_CHUNKING_SETTINGS)) {
157138
out.writeOptionalNamedWriteable(chunkingSettings);
158139
}
159-
if (out.getTransportVersion().onOrAfter(TransportVersions.INFERENCE_API_PARAMATERS_INTRODUCED)) {
160-
out.writeEnum(endpointVersion); // not nullable after 9.0
161-
}
162140
}
163141

164142
public String getInferenceEntityId() {
@@ -185,10 +163,6 @@ public ChunkingSettings getChunkingSettings() {
185163
return chunkingSettings;
186164
}
187165

188-
public EndpointVersions getEndpointVersion() {
189-
return endpointVersion;
190-
}
191-
192166
@Override
193167
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
194168
builder.startObject();
@@ -204,11 +178,10 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
204178
if (chunkingSettings != null) {
205179
builder.field(CHUNKING_SETTINGS, chunkingSettings);
206180
}
207-
if (params.paramAsBoolean(INCLUDE_PARAMETERS, true)) { // default true so that REST requests get parameters
208-
builder.field(PARAMETERS, taskSettings);
209-
}
210181
if (params.paramAsBoolean(FOR_INDEX, false)) {
211-
builder.field(ENDPOINT_VERSION_FIELD_NAME, endpointVersion); // only write endpoint version for index, not for REST
182+
// Don't write parameter to index, but do write parameters the rest of the time
183+
} else {
184+
builder.field(PARAMETERS, taskSettings);
212185
}
213186
builder.endObject();
214187
return builder;
@@ -229,11 +202,10 @@ public XContentBuilder toFilteredXContent(XContentBuilder builder, Params params
229202
if (chunkingSettings != null) {
230203
builder.field(CHUNKING_SETTINGS, chunkingSettings);
231204
}
232-
if (params.paramAsBoolean(INCLUDE_PARAMETERS, true)) { // default true so that REST requests get parameters
233-
builder.field(PARAMETERS, taskSettings);
234-
}
235205
if (params.paramAsBoolean(FOR_INDEX, false)) {
236-
builder.field(ENDPOINT_VERSION_FIELD_NAME, endpointVersion);
206+
// Don't write parameter to index, but do write parameters the rest of the time
207+
} else {
208+
builder.field(PARAMETERS, taskSettings);
237209
}
238210
builder.endObject();
239211
return builder;
@@ -258,12 +230,11 @@ public boolean equals(Object o) {
258230
&& taskType == model.taskType
259231
&& Objects.equals(service, model.service)
260232
&& Objects.equals(serviceSettings, model.serviceSettings)
261-
&& Objects.equals(taskSettings, model.taskSettings)
262-
&& Objects.equals(endpointVersion, model.endpointVersion);
233+
&& Objects.equals(taskSettings, model.taskSettings);
263234
}
264235

265236
@Override
266237
public int hashCode() {
267-
return Objects.hash(inferenceEntityId, taskType, service, serviceSettings, taskSettings, endpointVersion);
238+
return Objects.hash(inferenceEntityId, taskType, service, serviceSettings, taskSettings);
268239
}
269240
}

server/src/main/java/org/elasticsearch/inference/UnparsedModel.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ public record UnparsedModel(
2020
TaskType taskType,
2121
String service,
2222
Map<String, Object> settings,
23-
Map<String, Object> secrets,
24-
EndpointVersions endpointVersion
23+
Map<String, Object> secrets
2524
) {}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/action/PutInferenceModelAction.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.elasticsearch.common.io.stream.StreamInput;
1717
import org.elasticsearch.common.io.stream.StreamOutput;
1818
import org.elasticsearch.common.xcontent.XContentHelper;
19-
import org.elasticsearch.inference.EndpointVersions;
2019
import org.elasticsearch.inference.ModelConfigurations;
2120
import org.elasticsearch.inference.TaskType;
2221
import org.elasticsearch.rest.RestStatus;
@@ -31,7 +30,6 @@
3130
import java.util.Map;
3231
import java.util.Objects;
3332

34-
import static org.elasticsearch.inference.ModelConfigurations.ENDPOINT_VERSION_FIELD_NAME;
3533
import static org.elasticsearch.inference.ModelConfigurations.TASK_SETTINGS;
3634
import static org.elasticsearch.inference.ModelConfigurations.PARAMETERS;
3735

@@ -90,13 +88,9 @@ public BytesReference getRewrittenContent() {
9088
);
9189
} else if (newContent.containsKey(PARAMETERS)) {
9290
newContent.put(TASK_SETTINGS, newContent.get(PARAMETERS));
93-
newContent.put(ENDPOINT_VERSION_FIELD_NAME, EndpointVersions.PARAMETERS_INTRODUCED_ENDPOINT_VERSION);
9491
newContent.remove(PARAMETERS);
95-
} else if (newContent.containsKey(TASK_SETTINGS)) {
96-
newContent.put(ENDPOINT_VERSION_FIELD_NAME, EndpointVersions.FIRST_ENDPOINT_VERSION);
97-
} else {
98-
newContent.put(ENDPOINT_VERSION_FIELD_NAME, EndpointVersions.FIRST_ENDPOINT_VERSION);
9992
}
93+
10094
try (XContentBuilder builder = XContentFactory.contentBuilder(this.contentType)) {
10195
builder.map(newContent);
10296
this.rewrittenContent = BytesReference.bytes(builder);

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/inference/action/PutInferenceModelActionTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.elasticsearch.common.bytes.BytesArray;
1313
import org.elasticsearch.common.bytes.BytesReference;
1414
import org.elasticsearch.common.xcontent.XContentHelper;
15-
import org.elasticsearch.inference.EndpointVersions;
1615
import org.elasticsearch.inference.TaskType;
1716
import org.elasticsearch.test.ESTestCase;
1817
import org.elasticsearch.xcontent.XContentBuilder;
@@ -25,7 +24,6 @@
2524
import java.util.Locale;
2625
import java.util.Map;
2726

28-
import static org.elasticsearch.inference.ModelConfigurations.ENDPOINT_VERSION_FIELD_NAME;
2927
import static org.elasticsearch.inference.ModelConfigurations.TASK_SETTINGS;
3028
import static org.elasticsearch.inference.ModelConfigurations.PARAMETERS;
3129

@@ -117,6 +115,5 @@ public void testWithTaskSettings() throws IOException {
117115
assertNull(map.get(PARAMETERS));
118116
assertEquals("elasticsearch", map.get("service"));
119117
assertEquals(serviceSettingsValues, map.get("service_settings"));
120-
assertEquals(ENDPOINT_VERSION_FIELD_NAME, EndpointVersions.FIRST_ENDPOINT_VERSION);
121118
}
122119
}

x-pack/plugin/inference/qa/test-service-plugin/src/main/java/org/elasticsearch/xpack/inference/mock/AbstractTestInferenceService.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.elasticsearch.common.ValidationException;
1313
import org.elasticsearch.common.io.stream.StreamInput;
1414
import org.elasticsearch.common.io.stream.StreamOutput;
15-
import org.elasticsearch.inference.EndpointVersions;
1615
import org.elasticsearch.inference.InferenceService;
1716
import org.elasticsearch.inference.Model;
1817
import org.elasticsearch.inference.ModelConfigurations;
@@ -60,8 +59,7 @@ public TestServiceModel parsePersistedConfigWithSecrets(
6059
String modelId,
6160
TaskType taskType,
6261
Map<String, Object> config,
63-
Map<String, Object> secrets,
64-
EndpointVersions endpointVersion
62+
Map<String, Object> secrets
6563
) {
6664
var serviceSettingsMap = (Map<String, Object>) config.remove(ModelConfigurations.SERVICE_SETTINGS);
6765
var secretSettingsMap = (Map<String, Object>) secrets.remove(ModelSecrets.SECRET_SETTINGS);
@@ -72,20 +70,20 @@ public TestServiceModel parsePersistedConfigWithSecrets(
7270
var taskSettingsMap = getTaskSettingsMap(config);
7371
var taskSettings = TestTaskSettings.fromMap(taskSettingsMap);
7472

75-
return new TestServiceModel(modelId, taskType, name(), serviceSettings, taskSettings, secretSettings, endpointVersion);
73+
return new TestServiceModel(modelId, taskType, name(), serviceSettings, taskSettings, secretSettings);
7674
}
7775

7876
@Override
7977
@SuppressWarnings("unchecked")
80-
public Model parsePersistedConfig(String modelId, TaskType taskType, Map<String, Object> config, EndpointVersions endpointVersion) {
78+
public Model parsePersistedConfig(String modelId, TaskType taskType, Map<String, Object> config) {
8179
var serviceSettingsMap = (Map<String, Object>) config.remove(ModelConfigurations.SERVICE_SETTINGS);
8280

8381
var serviceSettings = getServiceSettingsFromMap(serviceSettingsMap);
8482

8583
var taskSettingsMap = getTaskSettingsMap(config);
8684
var taskSettings = TestTaskSettings.fromMap(taskSettingsMap);
8785

88-
return new TestServiceModel(modelId, taskType, name(), serviceSettings, taskSettings, null, endpointVersion);
86+
return new TestServiceModel(modelId, taskType, name(), serviceSettings, taskSettings, null);
8987
}
9088

9189
protected abstract ServiceSettings getServiceSettingsFromMap(Map<String, Object> serviceSettingsMap);
@@ -106,13 +104,9 @@ public TestServiceModel(
106104
String service,
107105
ServiceSettings serviceSettings,
108106
TestTaskSettings taskSettings,
109-
TestSecretSettings secretSettings,
110-
EndpointVersions endpointVersion
107+
TestSecretSettings secretSettings
111108
) {
112-
super(
113-
new ModelConfigurations(modelId, taskType, service, serviceSettings, taskSettings, endpointVersion),
114-
new ModelSecrets(secretSettings)
115-
);
109+
super(new ModelConfigurations(modelId, taskType, service, serviceSettings, taskSettings), new ModelSecrets(secretSettings));
116110
}
117111

118112
@Override

0 commit comments

Comments
 (0)