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
All Implemented Interfaces:
Writeable, ToXContent, ToXContentFragment

public record EmbeddingRequest(List<InferenceStringGroup> inputs, InputType inputType) 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 InferenceString.DataType, InferenceString.DataFormat and the String value of the input. The format field is optional, and if not specified will use the default InferenceString.DataFormat for the given InferenceString.DataType:
 "input": [
   {
     "content": {"type": "image", "format": "base64", "value": "image data"},
   },
   {
     "content": [
       {"type": "text", "value": "text input"},
       {"type": "image", "value": "image data"}
     ]
   }
 ]
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 InferenceString.DataType equal to InferenceString.DataType.TEXT and InferenceString.DataFormat equal to InferenceString.DataFormat.TEXT:
 "input": "singe text input"
OR
 "input": ["first text input", "second text input"]