Class RequestEmbedding.Builder

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

public static class RequestEmbedding.Builder extends WithJsonObjectBuilderBase<RequestEmbedding.Builder> implements ObjectBuilder<RequestEmbedding>
Builder for RequestEmbedding.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • input

      public final RequestEmbedding.Builder input(EmbeddingInput value)
      Required - Inference input. Either a string, an array of strings, a content object, or an array of content objects. content objects may contain a single item or an array of items. Models that support multiple items per content object will return a single embedding for each content object, regardless of how many items it contains. Support for multiple items in a single content object is available in Elasticsearch 9.5.0 and later.

      string example:

       "input": "Some text"
       
       

      string array example:

       "input": ["Some text", "Some more text"]
       
       

      content object example:

       "input": {
           "content": {
             "type": "image",
             "format": "base64",
             "value": "data:image/jpeg;base64,..."
           }
         }
       
       

      content object array example:

       "input": [
         {
           "content": {
             "type": "text",
             "format": "text",
             "value": "Some text to generate an embedding"
           }
         },
         {
           "content": {
             "type": "image",
             "format": "base64",
             "value": "data:image/jpeg;base64,..."
           }
         }
       ]
       
       

      Multiple items in one content object example (available in Elasticsearch 9.5.0 and later):

       "input": [
         {
           "content": [
             {
               "type": "image",
               "format": "base64",
               "value": "data:image/jpeg;base64,..."
             },
             {
               "type": "text",
               "value": "Some text to create an embedding"
             }
           ]
         }
       ]
       
       

      API name: input

    • input

      Required - Inference input. Either a string, an array of strings, a content object, or an array of content objects. content objects may contain a single item or an array of items. Models that support multiple items per content object will return a single embedding for each content object, regardless of how many items it contains. Support for multiple items in a single content object is available in Elasticsearch 9.5.0 and later.

      string example:

       "input": "Some text"
       
       

      string array example:

       "input": ["Some text", "Some more text"]
       
       

      content object example:

       "input": {
           "content": {
             "type": "image",
             "format": "base64",
             "value": "data:image/jpeg;base64,..."
           }
         }
       
       

      content object array example:

       "input": [
         {
           "content": {
             "type": "text",
             "format": "text",
             "value": "Some text to generate an embedding"
           }
         },
         {
           "content": {
             "type": "image",
             "format": "base64",
             "value": "data:image/jpeg;base64,..."
           }
         }
       ]
       
       

      Multiple items in one content object example (available in Elasticsearch 9.5.0 and later):

       "input": [
         {
           "content": [
             {
               "type": "image",
               "format": "base64",
               "value": "data:image/jpeg;base64,..."
             },
             {
               "type": "text",
               "value": "Some text to create an embedding"
             }
           ]
         }
       ]
       
       

      API name: input

    • inputType

      public final RequestEmbedding.Builder inputType(@Nullable String value)
      The input data type for the embedding model. Possible values include:
      • SEARCH
      • INGEST
      • CLASSIFICATION
      • CLUSTERING

      Not all models 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

    • taskSettings

      public final RequestEmbedding.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

    • self

      protected RequestEmbedding.Builder self()
      Specified by:
      self in class WithJsonObjectBuilderBase<RequestEmbedding.Builder>
    • build

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