Record Class EmbeddingRequest

java.lang.Object
java.lang.Record
org.elasticsearch.inference.EmbeddingRequest
Record Components:
inputs - The list of InferenceStringGroup inputs to generate embeddings for
inputType - The InputType of the request
taskSettings - The map of task settings specific to this request
All Implemented Interfaces:
Writeable, ToXContent, ToXContentFragment

public record EmbeddingRequest(List<InferenceStringGroup> inputs, InputType inputType, Map<String,Object> taskSettings) extends Record implements Writeable, ToXContentFragment
This class handles the parsing of inputs used by the TaskType.EMBEDDING task type. The input for this task is specified using a list of "content" objects, each of which specifies the DataType, DataFormat and the String value of the input. The format field is optional, and if not specified will use the default DataFormat for the given DataType:
 "input": [
   {
     "content": {"type": "image", "format": "base64", "value": "data:image/png;base64,..."},
   },
   {
     "content": [
       {"type": "text", "value": "text input"},
       {"type": "image", "value": "data:image/png;base64,..."}
     ]
   }
 ]
It is also possible to specify a single content object rather than a list:
 "input": {
   "content": {"type": "text", "format": "text", "value": "text input"}
 }
To preserve input compatibility with the existing TaskType.TEXT_EMBEDDING task, the input can also be specified as a single String or a list of Strings, each of which will be parsed into a content object with DataType equal to DataType.TEXT and DataFormat equal to DataFormat.TEXT:
 "input": "singe text input"
OR
 "input": ["first text input", "second text input"]