diff --git a/src/main/java/io/stargate/sgv2/jsonapi/service/embedding/configuration/EmbeddingProvidersConfigImpl.java b/src/main/java/io/stargate/sgv2/jsonapi/service/embedding/configuration/EmbeddingProvidersConfigImpl.java index 1260a26607..95a2ec93ca 100644 --- a/src/main/java/io/stargate/sgv2/jsonapi/service/embedding/configuration/EmbeddingProvidersConfigImpl.java +++ b/src/main/java/io/stargate/sgv2/jsonapi/service/embedding/configuration/EmbeddingProvidersConfigImpl.java @@ -36,7 +36,9 @@ public ModelConfigImpl( List modelParameterList) { this( grpcModelConfig.getName(), - Optional.ofNullable(grpcModelConfig.getVectorDimension()), + grpcModelConfig.hasVectorDimension() + ? Optional.of(grpcModelConfig.getVectorDimension()) + : Optional.empty(), modelParameterList, grpcModelConfig.getPropertiesMap()); } @@ -57,13 +59,13 @@ public ParameterConfigImpl( grpcModelParameter.getName(), ParameterType.valueOf(grpcModelParameter.getType().name()), grpcModelParameter.getRequired(), - Optional.ofNullable(grpcModelParameter.getDefaultValue()), + Optional.of(grpcModelParameter.getDefaultValue()), grpcModelParameter.getValidationMap().entrySet().stream() .collect( Collectors.toMap( e -> ValidationType.fromString(e.getKey()), e -> new ArrayList<>(e.getValue().getValuesList()))), - Optional.ofNullable(grpcModelParameter.getHelp())); + Optional.of(grpcModelParameter.getHelp())); } } @@ -82,9 +84,9 @@ public RequestPropertiesImpl( grpcProviderConfigProperties.getMaxRetries(), grpcProviderConfigProperties.getRetryDelayMillis(), grpcProviderConfigProperties.getRequestTimeoutMillis(), - Optional.ofNullable(grpcProviderConfigProperties.getMaxInputLength()), - Optional.ofNullable(grpcProviderConfigProperties.getTaskTypeStore()), - Optional.ofNullable(grpcProviderConfigProperties.getTaskTypeRead())); + Optional.of(grpcProviderConfigProperties.getMaxInputLength()), + Optional.of(grpcProviderConfigProperties.getTaskTypeStore()), + Optional.of(grpcProviderConfigProperties.getTaskTypeRead())); } } }