diff --git a/docs/changelog/128241.yaml b/docs/changelog/128241.yaml new file mode 100644 index 0000000000000..26e3154fb7fde --- /dev/null +++ b/docs/changelog/128241.yaml @@ -0,0 +1,5 @@ +pr: 128241 +summary: Adding VoyageAI's v3.5 models +area: Machine Learning +type: enhancement +issues: [] diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/voyageai/VoyageAIModel.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/voyageai/VoyageAIModel.java index f2280b50a8542..7cd816fcc042d 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/voyageai/VoyageAIModel.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/voyageai/VoyageAIModel.java @@ -21,33 +21,32 @@ import org.elasticsearch.xpack.inference.services.voyageai.action.VoyageAIActionVisitor; import java.net.URI; +import java.util.Collections; +import java.util.HashMap; import java.util.Map; import java.util.Objects; public abstract class VoyageAIModel extends RateLimitGroupingModel { private static final String DEFAULT_MODEL_FAMILY = "default_model_family"; - private static final Map MODEL_TO_MODEL_FAMILY = Map.of( - "voyage-multimodal-3", - "embed_multimodal", - "voyage-3-large", - "embed_large", - "voyage-code-3", - "embed_large", - "voyage-3", - "embed_medium", - "voyage-3-lite", - "embed_small", - "voyage-finance-2", - "embed_large", - "voyage-law-2", - "embed_large", - "voyage-code-2", - "embed_large", - "rerank-2", - "rerank_large", - "rerank-2-lite", - "rerank_small" - ); + private static final Map MODEL_TO_MODEL_FAMILY; + + static { + Map tempMap = new HashMap<>(); + tempMap.put("voyage-3.5", "embed_medium"); + tempMap.put("voyage-3.5-lite", "embed_small"); + tempMap.put("voyage-multimodal-3", "embed_multimodal"); + tempMap.put("voyage-3-large", "embed_large"); + tempMap.put("voyage-code-3", "embed_large"); + tempMap.put("voyage-3", "embed_medium"); + tempMap.put("voyage-3-lite", "embed_small"); + tempMap.put("voyage-finance-2", "embed_large"); + tempMap.put("voyage-law-2", "embed_large"); + tempMap.put("voyage-code-2", "embed_large"); + tempMap.put("rerank-2", "rerank_large"); + tempMap.put("rerank-2-lite", "rerank_small"); + + MODEL_TO_MODEL_FAMILY = Collections.unmodifiableMap(tempMap); + } private final SecureString apiKey; private final VoyageAIRateLimitServiceSettings rateLimitServiceSettings;