Class InferenceRequest.Builder

All Implemented Interfaces:
WithJson<InferenceRequest.Builder>, ObjectBuilder<InferenceRequest>
Enclosing class:
InferenceRequest

public static class InferenceRequest.Builder extends RequestBase.AbstractBuilder<InferenceRequest.Builder> implements ObjectBuilder<InferenceRequest>
Builder for InferenceRequest.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • inferenceId

      public final InferenceRequest.Builder inferenceId(String value)
      Required - The unique identifier for the inference endpoint.

      API name: inference_id

    • input

      public final InferenceRequest.Builder input(List<String> list)
      Required - The text on which you want to perform the inference task. It can be a single string or an array.

      info Inference endpoints for the completion task type currently only support a single string as input.

      API name: input

      Adds all elements of list to input.

    • input

      public final InferenceRequest.Builder input(String value, String... values)
      Required - The text on which you want to perform the inference task. It can be a single string or an array.

      info Inference endpoints for the completion task type currently only support a single string as input.

      API name: input

      Adds one or more values to input.

    • inputType

      public final InferenceRequest.Builder inputType(@Nullable String value)
      Specifies the input data type for the text embedding model. The input_type parameter only applies to Inference Endpoints with the text_embedding task type. Possible values include:
      • SEARCH
      • INGEST
      • CLASSIFICATION
      • CLUSTERING Not all services support all values. Unsupported values will trigger a validation exception. Accepted values depend on the configured inference service, refer to the relevant service-specific documentation for more info.

      info The input_type parameter specified on the root level of the request body will take precedence over the input_type parameter specified in task_settings.

      API name: input_type

    • query

      public final InferenceRequest.Builder query(@Nullable String value)
      The query input, which is required only for the rerank task. It is not required for other tasks.

      API name: query

    • taskSettings

      public final InferenceRequest.Builder taskSettings(@Nullable JsonData value)
      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

    • taskType

      public final InferenceRequest.Builder taskType(@Nullable TaskType value)
      The type of inference task that the model performs.

      API name: task_type

    • timeout

      public final InferenceRequest.Builder timeout(@Nullable Time value)
      The amount of time to wait for the inference request to complete.

      API name: timeout

    • timeout

      The amount of time to wait for the inference request to complete.

      API name: timeout

    • self

      protected InferenceRequest.Builder self()
      Specified by:
      self in class RequestBase.AbstractBuilder<InferenceRequest.Builder>
    • build

      public InferenceRequest build()
      Specified by:
      build in interface ObjectBuilder<InferenceRequest>
      Throws:
      NullPointerException - if some of the required fields are null.