Skip to content

Commit d785a6c

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent 4ef37f5 commit d785a6c

File tree

7 files changed

+36
-73
lines changed

7 files changed

+36
-73
lines changed

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -166,28 +166,12 @@ public static List<NamedWriteableRegistry.Entry> getNamedWriteables() {
166166

167167
private static void addCustomNamedWriteables(List<NamedWriteableRegistry.Entry> namedWriteables) {
168168
namedWriteables.add(
169-
new NamedWriteableRegistry.Entry(
170-
ServiceSettings.class,
171-
CustomServiceSettings.NAME,
172-
CustomServiceSettings::new
173-
)
169+
new NamedWriteableRegistry.Entry(ServiceSettings.class, CustomServiceSettings.NAME, CustomServiceSettings::new)
174170
);
175171

176-
namedWriteables.add(
177-
new NamedWriteableRegistry.Entry(
178-
TaskSettings.class,
179-
CustomTaskSettings.NAME,
180-
CustomTaskSettings::new
181-
)
182-
);
172+
namedWriteables.add(new NamedWriteableRegistry.Entry(TaskSettings.class, CustomTaskSettings.NAME, CustomTaskSettings::new));
183173

184-
namedWriteables.add(
185-
new NamedWriteableRegistry.Entry(
186-
SecretSettings.class,
187-
CustomSecretSettings.NAME,
188-
CustomSecretSettings::new
189-
)
190-
);
174+
namedWriteables.add(new NamedWriteableRegistry.Entry(SecretSettings.class, CustomSecretSettings.NAME, CustomSecretSettings::new));
191175
}
192176

193177
private static void addUnifiedNamedWriteables(List<NamedWriteableRegistry.Entry> namedWriteables) {

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/CustomService.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,27 +168,15 @@ public CustomModel parsePersistedConfigWithSecrets(
168168
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.TASK_SETTINGS);
169169
Map<String, Object> secretSettingsMap = removeFromMapOrThrowIfNull(secrets, ModelSecrets.SECRET_SETTINGS);
170170

171-
return createModelWithoutLoggingDeprecations(
172-
inferenceEntityId,
173-
taskType,
174-
serviceSettingsMap,
175-
taskSettingsMap,
176-
secretSettingsMap
177-
);
171+
return createModelWithoutLoggingDeprecations(inferenceEntityId, taskType, serviceSettingsMap, taskSettingsMap, secretSettingsMap);
178172
}
179173

180174
@Override
181175
public CustomModel parsePersistedConfig(String inferenceEntityId, TaskType taskType, Map<String, Object> config) {
182176
Map<String, Object> serviceSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.SERVICE_SETTINGS);
183177
Map<String, Object> taskSettingsMap = removeFromMapOrThrowIfNull(config, ModelConfigurations.TASK_SETTINGS);
184178

185-
return createModelWithoutLoggingDeprecations(
186-
inferenceEntityId,
187-
taskType,
188-
serviceSettingsMap,
189-
taskSettingsMap,
190-
null
191-
);
179+
return createModelWithoutLoggingDeprecations(inferenceEntityId, taskType, serviceSettingsMap, taskSettingsMap, null);
192180
}
193181

194182
@Override

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/CustomTaskSettings.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ public static CustomTaskSettings fromMap(Map<String, Object> map) {
4141

4242
Map<String, Object> parameters = extractOptionalMap(map, PARAMETERS, ModelConfigurations.TASK_SETTINGS, validationException);
4343
removeNullValues(parameters);
44-
validateMapValues(parameters, List.of(String.class, Integer.class, Double.class, Float.class, Boolean.class), PARAMETERS, validationException, false);
44+
validateMapValues(
45+
parameters,
46+
List.of(String.class, Integer.class, Double.class, Float.class, Boolean.class),
47+
PARAMETERS,
48+
validationException,
49+
false
50+
);
4551

4652
if (validationException.validationErrors().isEmpty() == false) {
4753
throw validationException;

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/request/CustomRequest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,25 @@ public CustomRequest(String query, List<String> input, CustomModel model) {
117117

118118
jsonParams.put(QUERY, toJson(query));
119119

120-
// Map<String, Object> customParamsObjectMap = new HashMap<>();
121-
// if (secretParameters != null) {
122-
// for (String key : secretParameters.keySet()) {
123-
// Object paramValue = secretParameters.get(key);
124-
// if (paramValue instanceof SecureString) {
125-
// customParamsObjectMap.put(key, ((SecureString) paramValue).toString());
126-
// } else {
127-
// customParamsObjectMap.put(key, paramValue);
128-
// }
129-
// }
130-
// }
131-
//
132-
// Map<String, String> customParams = new HashMap<String, String>();
133-
// if (taskSettings.getParameters() != null && taskSettings.getParameters().isEmpty() == false) {
134-
// Map<String, String> taskParams = getParameterMap(taskSettings.getParameters());
135-
// for (String key : taskParams.keySet()) {
136-
// customParams.put(key, taskParams.get(key));
137-
// }
138-
// }
120+
// Map<String, Object> customParamsObjectMap = new HashMap<>();
121+
// if (secretParameters != null) {
122+
// for (String key : secretParameters.keySet()) {
123+
// Object paramValue = secretParameters.get(key);
124+
// if (paramValue instanceof SecureString) {
125+
// customParamsObjectMap.put(key, ((SecureString) paramValue).toString());
126+
// } else {
127+
// customParamsObjectMap.put(key, paramValue);
128+
// }
129+
// }
130+
// }
131+
//
132+
// Map<String, String> customParams = new HashMap<String, String>();
133+
// if (taskSettings.getParameters() != null && taskSettings.getParameters().isEmpty() == false) {
134+
// Map<String, String> taskParams = getParameterMap(taskSettings.getParameters());
135+
// for (String key : taskParams.keySet()) {
136+
// customParams.put(key, taskParams.get(key));
137+
// }
138+
// }
139139

140140
// if user's custom parameters contain input and query, it will be replaced by inference's input and query
141141
if (query != null) {

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/response/NoopResponseParser.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public NoopResponseParser(StreamInput in) {
3333
this();
3434
}
3535

36-
public void writeTo(StreamOutput out) throws IOException {
37-
}
38-
36+
public void writeTo(StreamOutput out) throws IOException {}
3937

4038
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
4139
return builder;

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/response/SparseEmbeddingResponseParser.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,9 @@ public class SparseEmbeddingResponseParser implements ResponseParser {
3535
public static SparseEmbeddingResponseParser fromMap(Map<String, Object> responseParserMap, ValidationException validationException) {
3636
var path = extractRequiredString(responseParserMap, SPARSE_RESULT_PATH, JSON_PARSER, validationException);
3737

38-
var tokenPath = extractRequiredString(
39-
responseParserMap,
40-
SPARSE_EMBEDDING_PARSER_TOKEN,
41-
JSON_PARSER,
42-
validationException
43-
);
44-
45-
var weightPath = extractRequiredString(
46-
responseParserMap,
47-
SPARSE_EMBEDDING_PARSER_WEIGHT,
48-
JSON_PARSER,
49-
validationException
50-
);
38+
var tokenPath = extractRequiredString(responseParserMap, SPARSE_EMBEDDING_PARSER_TOKEN, JSON_PARSER, validationException);
39+
40+
var weightPath = extractRequiredString(responseParserMap, SPARSE_EMBEDDING_PARSER_WEIGHT, JSON_PARSER, validationException);
5141

5242
if (path == null || tokenPath == null || weightPath == null) {
5343
throw validationException;

x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/custom/CustomServiceSettingsTests.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ public void testFromMap() {
155155
Map.of(
156156
CustomServiceSettings.JSON_PARSER,
157157
new HashMap<>(
158-
Map.of(
159-
CustomServiceSettings.TEXT_EMBEDDING_PARSER_EMBEDDINGS,
160-
"$.result.embeddings[*].embedding"
161-
)
158+
Map.of(CustomServiceSettings.TEXT_EMBEDDING_PARSER_EMBEDDINGS, "$.result.embeddings[*].embedding")
162159
)
163160
)
164161
)

0 commit comments

Comments
 (0)