You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Inference API] Use dimensions field in JinaAI text_embedding requests (#139552)
The dimensions field was parsed from the service settings but never
used. This commit includes the dimensions field in text embedding
requests sent to JinaAI when set by the user.
* Add dimensions_set_by_user to JinaAIEmbeddingsServiceSettings
* Move similarity and max_input_tokens to exposed fields
(cherry picked from commit b2ecf87)
Copy file name to clipboardExpand all lines: x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIService.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -308,7 +308,8 @@ public Model updateModelWithEmbeddingDetails(Model model, int embeddingSize) {
308
308
similarityToUse,
309
309
embeddingSize,
310
310
maxInputTokens,
311
-
serviceSettings.getEmbeddingType()
311
+
serviceSettings.getEmbeddingType(),
312
+
serviceSettings.dimensionsSetByUser()
312
313
);
313
314
314
315
return new JinaAIEmbeddingsModel(embeddingsModel, updatedServiceSettings);
Copy file name to clipboardExpand all lines: x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/embeddings/JinaAIEmbeddingsServiceSettings.java
Copy file name to clipboardExpand all lines: x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequest.java
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,8 @@ public class JinaAIEmbeddingsRequest extends JinaAIRequest {
34
34
private final String model;
35
35
private final String inferenceEntityId;
36
36
private final JinaAIEmbeddingType embeddingType;
37
+
private final Integer dimensions;
38
+
private final boolean dimensionsSetByUser;
37
39
38
40
public JinaAIEmbeddingsRequest(List<String> input, InputType inputType, JinaAIEmbeddingsModel embeddingsModel) {
39
41
Objects.requireNonNull(embeddingsModel);
@@ -45,15 +47,18 @@ public JinaAIEmbeddingsRequest(List<String> input, InputType inputType, JinaAIEm
45
47
model = embeddingsModel.getServiceSettings().getCommonSettings().modelId();
0 commit comments