Class OpenAIServiceSettings.Builder
java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<OpenAIServiceSettings.Builder>
co.elastic.clients.elasticsearch.inference.OpenAIServiceSettings.Builder
- All Implemented Interfaces:
WithJson<OpenAIServiceSettings.Builder>,ObjectBuilder<OpenAIServiceSettings>
- Enclosing class:
- OpenAIServiceSettings
public static class OpenAIServiceSettings.Builder
extends WithJsonObjectBuilderBase<OpenAIServiceSettings.Builder>
implements ObjectBuilder<OpenAIServiceSettings>
Builder for
OpenAIServiceSettings.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRequired - A valid API key of your OpenAI account.build()Builds aOpenAIServiceSettings.dimensions(Integer value) The number of dimensions the resulting output embeddings should have.Required - The name of the model to use for the inference task.organizationId(String value) The unique identifier for your organization.rateLimit(RateLimitSetting value) This setting helps to minimize the number of rate limit errors returned from OpenAI.This setting helps to minimize the number of rate limit errors returned from OpenAI.protected OpenAIServiceSettings.Builderself()The URL endpoint to use for the requests.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJsonMethods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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. After creating the inference model, you cannot change the associated API key. If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key.
API name:
api_key -
dimensions
The number of dimensions the resulting output embeddings should have. It is supported only intext-embedding-3and later models. If it is not set, the OpenAI defined default for the model is used.API name:
dimensions -
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
The unique identifier for your organization. You can find the Organization ID in your OpenAI account under Settings > Organizations.API name:
organization_id -
rateLimit
This setting helps to minimize the number of rate limit errors returned from OpenAI. Theopenaiservice sets a default number of requests allowed per minute depending on the task type. Fortext_embedding, it is set to3000. Forcompletion, it is set to500.API name:
rate_limit -
rateLimit
public final OpenAIServiceSettings.Builder rateLimit(Function<RateLimitSetting.Builder, ObjectBuilder<RateLimitSetting>> fn) This setting helps to minimize the number of rate limit errors returned from OpenAI. Theopenaiservice sets a default number of requests allowed per minute depending on the task type. Fortext_embedding, it is set to3000. Forcompletion, it is set to500.API name:
rate_limit -
url
The URL endpoint to use for the requests. It can be changed for testing purposes.API name:
url -
self
- Specified by:
selfin classWithJsonObjectBuilderBase<OpenAIServiceSettings.Builder>
-
build
Builds aOpenAIServiceSettings.- Specified by:
buildin interfaceObjectBuilder<OpenAIServiceSettings>- Throws:
NullPointerException- if some of the required fields are null.
-