Class CompletionRequest
- All Implemented Interfaces:
JsonpSerializable
Get responses for completion tasks. This API works only with the completion task type.
IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.
This API requires the monitor_inference cluster privilege (the
built-in inference_admin and inference_user roles
grant this privilege).
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<CompletionRequest>Json deserializer forCompletionRequeststatic final Endpoint<CompletionRequest,CompletionResponse, ErrorResponse> Endpoint "inference.completion". -
Method Summary
Modifier and TypeMethodDescriptionfinal StringRequired - The inference Idinput()Required - Inference input.static CompletionRequestrebuild()voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected voidserializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static voidfinal JsonDataTask settings for the individual inference request.final Timetimeout()Specifies the amount of time to wait for the inference request to complete.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toString
-
Field Details
-
_DESERIALIZER
Json deserializer forCompletionRequest -
_ENDPOINT
Endpoint "inference.completion".
-
-
Method Details
-
of
public static CompletionRequest of(Function<CompletionRequest.Builder, ObjectBuilder<CompletionRequest>> fn) -
inferenceId
Required - The inference IdAPI name:
inference_id -
input
Required - Inference input. Either a string or an array of strings.API name:
input -
taskSettings
Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service.API name:
task_settings -
timeout
Specifies the amount of time to wait for the inference request to complete.API name:
timeout -
serialize
Serialize this object to JSON.- Specified by:
serializein interfaceJsonpSerializable
-
serializeInternal
-
rebuild
- Returns:
- New
CompletionRequest.Builderinitialized with field values of this instance
-
setupCompletionRequestDeserializer
protected static void setupCompletionRequestDeserializer(ObjectDeserializer<CompletionRequest.Builder> op)
-