Class OpenAIServiceSettings

java.lang.Object
co.elastic.clients.elasticsearch.inference.OpenAIServiceSettings
All Implemented Interfaces:
JsonpSerializable

@JsonpDeserializable public class OpenAIServiceSettings extends Object implements JsonpSerializable
See Also:
  • Field Details

  • Method Details

    • of

    • apiKey

      public final String apiKey()
      Required - A valid API key of your OpenAI account. You can find your OpenAI API keys in your OpenAI account under the API keys section.

      IMPORTANT: You need to provide the API key only once, during the inference model creation. The get inference endpoint API does not retrieve your API key.

      API name: api_key

    • dimensions

      @Nullable public final Integer dimensions()
      The number of dimensions the resulting output embeddings should have. It is supported only in text-embedding-3 and later models. If it is not set, the OpenAI defined default for the model is used.

      API name: dimensions

    • modelId

      public final String modelId()
      Required - The name of the model to use for the inference task. Refer to the OpenAI documentation for the list of available text embedding models.

      API name: model_id

    • organizationId

      @Nullable public final String organizationId()
      The unique identifier for your organization. You can find the Organization ID in your OpenAI account under Settings > Organizations.

      API name: organization_id

    • rateLimit

      @Nullable public final RateLimitSetting rateLimit()
      This setting helps to minimize the number of rate limit errors returned from OpenAI. The openai service sets a default number of requests allowed per minute depending on the task type. For text_embedding, it is set to 3000. For completion, it is set to 500.

      API name: rate_limit

    • similarity

      @Nullable public final OpenAISimilarityType similarity()
      For a text_embedding task, the similarity measure. One of cosine, dot_product, l2_norm. Defaults to dot_product.

      API name: similarity

    • url

      @Nullable public final String url()
      The URL endpoint to use for the requests. It can be changed for testing purposes.

      API name: url

    • serialize

      public void serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Serialize this object to JSON.
      Specified by:
      serialize in interface JsonpSerializable
    • serializeInternal

      protected void serializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • rebuild

      Returns:
      New OpenAIServiceSettings.Builder initialized with field values of this instance
    • setupOpenAIServiceSettingsDeserializer

      protected static void setupOpenAIServiceSettingsDeserializer(ObjectDeserializer<OpenAIServiceSettings.Builder> op)