Browse Source

[Inference API] Remove unused class AzureOpenAiAccount (#108356)

Tim Grein 1 year ago
parent
commit
22d730815d

+ 0 - 40
x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/azureopenai/AzureOpenAiAccount.java

@@ -1,40 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0; you may not use this file except in compliance with the Elastic License
- * 2.0.
- */
-
-package org.elasticsearch.xpack.inference.external.azureopenai;
-
-import org.elasticsearch.common.settings.SecureString;
-import org.elasticsearch.core.Nullable;
-import org.elasticsearch.xpack.inference.services.azureopenai.embeddings.AzureOpenAiEmbeddingsModel;
-
-import java.util.Objects;
-
-public record AzureOpenAiAccount(
-    String resourceName,
-    String deploymentId,
-    String apiVersion,
-    @Nullable SecureString apiKey,
-    @Nullable SecureString entraId
-) {
-
-    public AzureOpenAiAccount {
-        Objects.requireNonNull(resourceName);
-        Objects.requireNonNull(deploymentId);
-        Objects.requireNonNull(apiVersion);
-        Objects.requireNonNullElse(apiKey, entraId);
-    }
-
-    public static AzureOpenAiAccount fromModel(AzureOpenAiEmbeddingsModel model) {
-        return new AzureOpenAiAccount(
-            model.getServiceSettings().resourceName(),
-            model.getServiceSettings().deploymentId(),
-            model.getServiceSettings().apiVersion(),
-            model.getSecretSettings().apiKey(),
-            model.getSecretSettings().entraId()
-        );
-    }
-}

+ 0 - 3
x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/request/azureopenai/AzureOpenAiEmbeddingsRequest.java

@@ -15,7 +15,6 @@ import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.ValidationException;
 import org.elasticsearch.xcontent.XContentType;
 import org.elasticsearch.xpack.inference.common.Truncator;
-import org.elasticsearch.xpack.inference.external.azureopenai.AzureOpenAiAccount;
 import org.elasticsearch.xpack.inference.external.request.HttpRequest;
 import org.elasticsearch.xpack.inference.external.request.Request;
 import org.elasticsearch.xpack.inference.services.azureopenai.embeddings.AzureOpenAiEmbeddingsModel;
@@ -34,14 +33,12 @@ public class AzureOpenAiEmbeddingsRequest implements AzureOpenAiRequest {
         "The request does not have any authentication methods set. One of [%s] or [%s] is required.";
 
     private final Truncator truncator;
-    private final AzureOpenAiAccount account;
     private final Truncator.TruncationResult truncationResult;
     private final URI uri;
     private final AzureOpenAiEmbeddingsModel model;
 
     public AzureOpenAiEmbeddingsRequest(Truncator truncator, Truncator.TruncationResult input, AzureOpenAiEmbeddingsModel model) {
         this.truncator = Objects.requireNonNull(truncator);
-        this.account = AzureOpenAiAccount.fromModel(model);
         this.truncationResult = Objects.requireNonNull(input);
         this.model = Objects.requireNonNull(model);
         this.uri = model.getUri();