Skip to content

Commit 8c9c4f4

Browse files
author
Max Hniebergall
committed
undo renaming task_settings field name
1 parent 104ab7c commit 8c9c4f4

File tree

51 files changed

+104
-110
lines changed

Some content is hidden

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

51 files changed

+104
-110
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ModelConfigurations implements ToFilteredXContentObject, VersionedN
2828
public static final String FOR_INDEX = "for_index"; // true if writing to index
2929
public static final String SERVICE = "service";
3030
public static final String SERVICE_SETTINGS = "service_settings";
31-
public static final String OLD_TASK_SETTINGS = "task_settings";
31+
public static final String TASK_SETTINGS = "task_settings";
3232
public static final String PARAMETERS = "parameters";
3333
public static final String CHUNKING_SETTINGS = "chunking_settings";
3434
public static final String INCLUDE_PARAMETERS = "include_parameters";
@@ -200,7 +200,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
200200
builder.field(TaskType.NAME, taskType.toString());
201201
builder.field(SERVICE, service);
202202
builder.field(SERVICE_SETTINGS, serviceSettings);
203-
builder.field(OLD_TASK_SETTINGS, taskSettings);
203+
builder.field(TASK_SETTINGS, taskSettings);
204204
if (chunkingSettings != null) {
205205
builder.field(CHUNKING_SETTINGS, chunkingSettings);
206206
}
@@ -225,7 +225,7 @@ public XContentBuilder toFilteredXContent(XContentBuilder builder, Params params
225225
builder.field(TaskType.NAME, taskType.toString());
226226
builder.field(SERVICE, service);
227227
builder.field(SERVICE_SETTINGS, serviceSettings.getFilteredXContentObject());
228-
builder.field(OLD_TASK_SETTINGS, taskSettings);
228+
builder.field(TASK_SETTINGS, taskSettings);
229229
if (chunkingSettings != null) {
230230
builder.field(CHUNKING_SETTINGS, chunkingSettings);
231231
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import java.util.Objects;
3333

3434
import static org.elasticsearch.inference.ModelConfigurations.ENDPOINT_VERSION_FIELD_NAME;
35-
import static org.elasticsearch.inference.ModelConfigurations.OLD_TASK_SETTINGS;
35+
import static org.elasticsearch.inference.ModelConfigurations.TASK_SETTINGS;
3636
import static org.elasticsearch.inference.ModelConfigurations.PARAMETERS;
3737

3838
public class PutInferenceModelAction extends ActionType<PutInferenceModelAction.Response> {
@@ -83,16 +83,16 @@ public BytesReference getContent() {
8383
public BytesReference getRewrittenContent() {
8484
if (rewrittenContent == null) { // rewrittenContent is deterministic on content, so we only need to calculate it once
8585
Map<String, Object> newContent = XContentHelper.convertToMap(content, false, contentType).v2();
86-
if (newContent.containsKey(PARAMETERS) && newContent.containsKey(OLD_TASK_SETTINGS)) {
86+
if (newContent.containsKey(PARAMETERS) && newContent.containsKey(TASK_SETTINGS)) {
8787
throw new ElasticsearchStatusException(
8888
"Request cannot contain both [task_settings] and [parameters], use only [parameters]",
8989
RestStatus.BAD_REQUEST
9090
);
9191
} else if (newContent.containsKey(PARAMETERS)) {
92-
newContent.put(OLD_TASK_SETTINGS, newContent.get(PARAMETERS));
92+
newContent.put(TASK_SETTINGS, newContent.get(PARAMETERS));
9393
newContent.put(ENDPOINT_VERSION_FIELD_NAME, EndpointVersions.PARAMETERS_INTRODUCED_ENDPOINT_VERSION);
9494
newContent.remove(PARAMETERS);
95-
} else if (newContent.containsKey(OLD_TASK_SETTINGS)) {
95+
} else if (newContent.containsKey(TASK_SETTINGS)) {
9696
newContent.put(ENDPOINT_VERSION_FIELD_NAME, EndpointVersions.FIRST_ENDPOINT_VERSION);
9797
} else {
9898
newContent.put(ENDPOINT_VERSION_FIELD_NAME, EndpointVersions.FIRST_ENDPOINT_VERSION);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.util.Map;
2727

2828
import static org.elasticsearch.inference.ModelConfigurations.ENDPOINT_VERSION_FIELD_NAME;
29-
import static org.elasticsearch.inference.ModelConfigurations.OLD_TASK_SETTINGS;
29+
import static org.elasticsearch.inference.ModelConfigurations.TASK_SETTINGS;
3030
import static org.elasticsearch.inference.ModelConfigurations.PARAMETERS;
3131

3232
public class PutInferenceModelActionTests extends ESTestCase {
@@ -76,7 +76,7 @@ public void testWithParameters() throws IOException {
7676
builder.map(Map.of(PARAMETERS, parametersValues, "service", "elasticsearch", "service_settings", serviceSettingsValues));
7777
var request = new PutInferenceModelAction.Request(TASK_TYPE, MODEL_ID, BytesReference.bytes(builder), XContentType.JSON);
7878
Map<String, Object> map = XContentHelper.convertToMap(request.getContent(), false, request.getContentType()).v2();
79-
assertEquals(parametersValues, map.get(OLD_TASK_SETTINGS));
79+
assertEquals(parametersValues, map.get(TASK_SETTINGS));
8080
assertNull(map.get(PARAMETERS));
8181
assertEquals("elasticsearch", map.get("service"));
8282
assertEquals(serviceSettingsValues, map.get("service_settings"));
@@ -91,7 +91,7 @@ public void testWithParametersAndTaskSettings() throws IOException {
9191
Map.of(
9292
PARAMETERS,
9393
parametersValues,
94-
OLD_TASK_SETTINGS,
94+
TASK_SETTINGS,
9595
taskSettingsValues,
9696
"service",
9797
"elasticsearch",
@@ -110,10 +110,10 @@ public void testWithTaskSettings() throws IOException {
110110
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
111111
Map<String, Object> taskSettingsValues = Map.of("top_n", 2, "top_p", 0.2);
112112
Map<String, Object> serviceSettingsValues = Map.of("model_id", "embed", "dimensions", 1024);
113-
builder.map(Map.of(OLD_TASK_SETTINGS, taskSettingsValues, "service", "elasticsearch", "service_settings", serviceSettingsValues));
113+
builder.map(Map.of(TASK_SETTINGS, taskSettingsValues, "service", "elasticsearch", "service_settings", serviceSettingsValues));
114114
var request = new PutInferenceModelAction.Request(TASK_TYPE, MODEL_ID, BytesReference.bytes(builder), XContentType.JSON);
115115
Map<String, Object> map = XContentHelper.convertToMap(request.getContent(), false, request.getContentType()).v2();
116-
assertEquals(taskSettingsValues, map.get(OLD_TASK_SETTINGS));
116+
assertEquals(taskSettingsValues, map.get(TASK_SETTINGS));
117117
assertNull(map.get(PARAMETERS));
118118
assertEquals("elasticsearch", map.get("service"));
119119
assertEquals(serviceSettingsValues, map.get("service_settings"));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public TransportVersion getMinimalSupportedVersion() {
4545
protected static Map<String, Object> getTaskSettingsMap(Map<String, Object> settings) {
4646
Map<String, Object> taskSettingsMap;
4747
// task settings are optional
48-
if (settings.containsKey(ModelConfigurations.OLD_TASK_SETTINGS)) {
49-
taskSettingsMap = (Map<String, Object>) settings.remove(ModelConfigurations.OLD_TASK_SETTINGS);
48+
if (settings.containsKey(ModelConfigurations.TASK_SETTINGS)) {
49+
taskSettingsMap = (Map<String, Object>) settings.remove(ModelConfigurations.TASK_SETTINGS);
5050
} else {
5151
taskSettingsMap = Map.of();
5252
}

x-pack/plugin/inference/src/internalClusterTest/java/org/elasticsearch/xpack/inference/integration/ModelRegistryIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
740740
builder.field(TaskType.NAME, getTaskType().toString());
741741
builder.field(SERVICE, getService());
742742
builder.field(SERVICE_SETTINGS, getServiceSettings());
743-
builder.field(OLD_TASK_SETTINGS, getTaskSettings());
743+
builder.field(TASK_SETTINGS, getTaskSettings());
744744
builder.endObject();
745745
return builder;
746746
}
@@ -767,7 +767,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
767767
builder.field(TaskType.NAME, getTaskType().toString());
768768
builder.field(SERVICE, getService());
769769
builder.field(SERVICE_SETTINGS, getServiceSettings());
770-
builder.field(OLD_TASK_SETTINGS, getTaskSettings());
770+
builder.field(TASK_SETTINGS, getTaskSettings());
771771
builder.endObject();
772772
return builder;
773773
}

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/registry/ModelRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,10 @@ static Map<String, Object> copySettingsMap(Map<String, Object> other) {
468468
result.put(ModelConfigurations.SERVICE_SETTINGS, copiedServiceSettings);
469469
}
470470

471-
var taskSettings = (Map<String, Object>) other.get(ModelConfigurations.OLD_TASK_SETTINGS);
471+
var taskSettings = (Map<String, Object>) other.get(ModelConfigurations.TASK_SETTINGS);
472472
if (taskSettings != null) {
473473
var copiedTaskSettings = copyMap1LevelDeep(taskSettings);
474-
result.put(ModelConfigurations.OLD_TASK_SETTINGS, copiedTaskSettings);
474+
result.put(ModelConfigurations.TASK_SETTINGS, copiedTaskSettings);
475475
}
476476

477477
var chunkSettings = (Map<String, Object>) other.get(ModelConfigurations.CHUNKING_SETTINGS);

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/alibabacloudsearch/AlibabaCloudSearchService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void parseRequestConfig(
7474
) {
7575
try {
7676
Map<String, Object> serviceSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.SERVICE_SETTINGS);
77-
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.OLD_TASK_SETTINGS);
77+
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
7878

7979
AlibabaCloudSearchModel model = createModel(
8080
inferenceEntityId,
@@ -182,7 +182,7 @@ public AlibabaCloudSearchModel parsePersistedConfigWithSecrets(
182182
EndpointVersions endpointVersion
183183
) {
184184
Map<String, Object> serviceSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.SERVICE_SETTINGS);
185-
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.OLD_TASK_SETTINGS);
185+
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.TASK_SETTINGS);
186186
Map<String, Object> secretSettingsMap = removeFromMapOrThrowIfNull(secrets, ModelSecrets.SECRET_SETTINGS);
187187

188188
return createModelWithoutLoggingDeprecations(
@@ -204,7 +204,7 @@ public AlibabaCloudSearchModel parsePersistedConfig(
204204
EndpointVersions endpointVersion
205205
) {
206206
Map<String, Object> serviceSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.SERVICE_SETTINGS);
207-
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.OLD_TASK_SETTINGS);
207+
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.TASK_SETTINGS);
208208

209209
return createModelWithoutLoggingDeprecations(
210210
inferenceEntityId,

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/alibabacloudsearch/embeddings/AlibabaCloudSearchEmbeddingsTaskSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static AlibabaCloudSearchEmbeddingsTaskSettings fromMap(Map<String, Objec
5353
InputType inputType = extractOptionalEnum(
5454
map,
5555
INPUT_TYPE,
56-
ModelConfigurations.OLD_TASK_SETTINGS,
56+
ModelConfigurations.TASK_SETTINGS,
5757
InputType::fromString,
5858
VALID_REQUEST_VALUES,
5959
validationException

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/alibabacloudsearch/sparse/AlibabaCloudSearchSparseTaskSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static AlibabaCloudSearchSparseTaskSettings fromMap(Map<String, Object> m
5353
InputType inputType = extractOptionalEnum(
5454
map,
5555
INPUT_TYPE,
56-
ModelConfigurations.OLD_TASK_SETTINGS,
56+
ModelConfigurations.TASK_SETTINGS,
5757
InputType::fromString,
5858
VALID_REQUEST_VALUES,
5959
validationException

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/amazonbedrock/AmazonBedrockService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void parseRequestConfig(
126126
) {
127127
try {
128128
Map<String, Object> serviceSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.SERVICE_SETTINGS);
129-
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.OLD_TASK_SETTINGS);
129+
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
130130

131131
AmazonBedrockModel model = createModel(
132132
modelId,
@@ -158,7 +158,7 @@ public Model parsePersistedConfigWithSecrets(
158158
EndpointVersions endpointVersion
159159
) {
160160
Map<String, Object> serviceSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.SERVICE_SETTINGS);
161-
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.OLD_TASK_SETTINGS);
161+
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.TASK_SETTINGS);
162162
Map<String, Object> secretSettingsMap = removeFromMapOrDefaultEmpty(secrets, ModelSecrets.SECRET_SETTINGS);
163163

164164
return createModel(
@@ -176,7 +176,7 @@ public Model parsePersistedConfigWithSecrets(
176176
@Override
177177
public Model parsePersistedConfig(String modelId, TaskType taskType, Map<String, Object> config, EndpointVersions endpointVersion) {
178178
Map<String, Object> serviceSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.SERVICE_SETTINGS);
179-
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.OLD_TASK_SETTINGS);
179+
Map<String, Object> taskSettingsMap = removeFromMapOrDefaultEmpty(config, ModelConfigurations.TASK_SETTINGS);
180180

181181
return createModel(
182182
modelId,

0 commit comments

Comments
 (0)