Class GoogleVertexAIServiceSettings.Builder
java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<GoogleVertexAIServiceSettings.Builder>
co.elastic.clients.elasticsearch.inference.GoogleVertexAIServiceSettings.Builder
- All Implemented Interfaces:
WithJson<GoogleVertexAIServiceSettings.Builder>,ObjectBuilder<GoogleVertexAIServiceSettings>
- Enclosing class:
- GoogleVertexAIServiceSettings
public static class GoogleVertexAIServiceSettings.Builder
extends WithJsonObjectBuilderBase<GoogleVertexAIServiceSettings.Builder>
implements ObjectBuilder<GoogleVertexAIServiceSettings>
Builder for
GoogleVertexAIServiceSettings.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aGoogleVertexAIServiceSettings.dimensions(Integer value) For atext_embeddingtask, the number of dimensions the resulting output embeddings should have.The name of the location to use for the inference task for the Google Vertex AI inference task.maxBatchSize(Integer value) Only applicable for thetext_embeddingtask type.The name of the model to use for the inference task.The name of the project to use for the Google Vertex AI inference task.The name of the Google Model Garden Provider forcompletionandchat_completiontasks.rateLimit(RateLimitSetting value) This setting helps to minimize the number of rate limit errors returned from Google Vertex AI.This setting helps to minimize the number of rate limit errors returned from Google Vertex AI.protected GoogleVertexAIServiceSettings.Builderself()serviceAccountJson(String value) Required - A valid service account in JSON format for the Google Vertex AI API.streamingUrl(String value) The URL for streamingcompletionandchat_completionrequests to a Google Model Garden provider endpoint.The URL for non-streamingcompletionrequests to a Google Model Garden provider endpoint.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
-
provider
public final GoogleVertexAIServiceSettings.Builder provider(@Nullable GoogleModelGardenProvider value) The name of the Google Model Garden Provider forcompletionandchat_completiontasks. In order for a Google Model Garden endpoint to be usedprovidermust be defined and be other thangoogle. Modes:- Google Model Garden (third-party models): set
providerto a supported non-googlevalue and provideurland/orstreaming_url. - Google Vertex AI: omit
provideror set it togoogle. In this mode, do not seturlorstreaming_urland Elastic will construct the endpoint url fromlocation,model_id, andproject_idparameters.
API name:
provider - Google Model Garden (third-party models): set
-
url
The URL for non-streamingcompletionrequests to a Google Model Garden provider endpoint. If bothurlandstreaming_urlare provided, each is used for its respective mode. Ifstreaming_urlis not provided,urlis also used for streamingcompletionandchat_completion. Ifprovideris not provided or set togoogle(Google Vertex AI), do not seturl(orstreaming_url). At least one ofurlorstreaming_urlmust be provided for Google Model Garden endpoint usage. Certain providers require separate URLs for streaming and non-streaming operations (e.g., Anthropic, Mistral, AI21). Others support both operation types through a single URL (e.g., Meta, Hugging Face). Information on constructing the URL for various providers can be found in the Google Model Garden documentation for the model, or on the endpoint’sSample requestpage. The request examples also illustrate the proper formatting for theurl.API name:
url -
streamingUrl
The URL for streamingcompletionandchat_completionrequests to a Google Model Garden provider endpoint. If bothstreaming_urlandurlare provided, each is used for its respective mode. Ifurlis not provided,streaming_urlis also used for non-streamingcompletionrequests. Ifprovideris not provided or set togoogle(Google Vertex AI), do not setstreaming_url(orurl). At least one ofstreaming_urlorurlmust be provided for Google Model Garden endpoint usage. Certain providers require separate URLs for streaming and non-streaming operations (e.g., Anthropic, Mistral, AI21). Others support both operation types through a single URL (e.g., Meta, Hugging Face). Information on constructing the URL for various providers can be found in the Google Model Garden documentation for the model, or on the endpoint’sSample requestpage. The request examples also illustrate the proper formatting for thestreaming_url.API name:
streaming_url -
location
The name of the location to use for the inference task for the Google Vertex AI inference task. For Google Vertex AI, whenprovideris omitted orgoogle,locationis optional. Whenlocationis omitted, the request targets the Google Vertex AI global endpoint (https://aiplatform.googleapis.com); when it is provided, the corresponding regional endpoint (https://<location>-aiplatform.googleapis.com) is used. The field must be omitted to select the global endpoint; an empty string is not a validlocation. For Google Model Garden'scompletionandchat_completiontasks, whenprovideris a supported non-googlevalue -locationis ignored. Refer to the Google documentation for the list of supported locations.API name:
location -
modelId
The name of the model to use for the inference task. For Google Vertex AImodel_idis mandatory. For Google Model Garden'scompletionandchat_completiontasks, whenprovideris a supported non-googlevalue -model_idwill be used for some providers that require it, otherwise - ignored. Refer to the Google documentation for the list of supported models for Google Vertex AI.API name:
model_id -
projectId
The name of the project to use for the Google Vertex AI inference task. For Google Vertex AIproject_idis mandatory. For Google Model Garden'scompletionandchat_completiontasks, whenprovideris a supported non-googlevalue -project_idis ignored.API name:
project_id -
rateLimit
This setting helps to minimize the number of rate limit errors returned from Google Vertex AI. By default, thegooglevertexaiservice sets the number of requests allowed per minute to 30.000.API name:
rate_limit -
rateLimit
public final GoogleVertexAIServiceSettings.Builder rateLimit(Function<RateLimitSetting.Builder, ObjectBuilder<RateLimitSetting>> fn) This setting helps to minimize the number of rate limit errors returned from Google Vertex AI. By default, thegooglevertexaiservice sets the number of requests allowed per minute to 30.000.API name:
rate_limit -
serviceAccountJson
Required - A valid service account in JSON format for the Google Vertex AI API.API name:
service_account_json -
dimensions
For atext_embeddingtask, the number of dimensions the resulting output embeddings should have. By default, the model's standard output dimension is used. Refer to the Google documentation for more information.API name:
dimensions -
maxBatchSize
Only applicable for thetext_embeddingtask type. Controls the batch size of chunked inference requests sent to Google Vertex AI.Setting this parameter lower reduces the risk of exceeding token limits but may result in more API calls. Setting it higher increases throughput but may risk hitting token limits.
To estimate a safe
max_batch_sizevalue, you can use it together with themax_chunk_sizeparameter using the following formula:max_batch_size ≈ max_chunk_size × 1.3 × 512 ÷ 20000Where:
1.3is an approximate tokens-per-word ratio512is the maximum number of chunks that can be generated per document20000is the Google Vertex AI token limit per request
This estimate assumes the worst-case scenario with a document generating the maximum 512 chunks.
API name:
max_batch_size -
self
- Specified by:
selfin classWithJsonObjectBuilderBase<GoogleVertexAIServiceSettings.Builder>
-
build
Builds aGoogleVertexAIServiceSettings.- Specified by:
buildin interfaceObjectBuilder<GoogleVertexAIServiceSettings>- Throws:
NullPointerException- if some of the required fields are null.
-