Class RequestEmbedding.Builder
- All Implemented Interfaces:
WithJson<RequestEmbedding.Builder>,ObjectBuilder<RequestEmbedding>
- Enclosing class:
- RequestEmbedding
RequestEmbedding.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aRequestEmbedding.final RequestEmbedding.Builderinput(EmbeddingInput value) Required - Inference input.final RequestEmbedding.BuilderRequired - Inference input.final RequestEmbedding.BuilderThe input data type for the embedding model.protected RequestEmbedding.Builderself()final RequestEmbedding.BuildertaskSettings(JsonData value) Task settings for the individual inference request.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJsonMethods inherited from class co.elastic.clients.util.ObjectBuilderBase
_checkSingleUse, _listAdd, _listAddAll, _mapPut, _mapPutAll
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
input
Required - Inference input. Either a string, an array of strings, acontentobject, or an array ofcontentobjects.contentobjects may contain a single item or an array of items. Models that support multiple items percontentobject will return a single embedding for eachcontentobject, regardless of how many items it contains. Support for multiple items in a singlecontentobject is available in Elasticsearch 9.5.0 and later.string example:
"input": "Some text"string array example:
"input": ["Some text", "Some more text"]contentobject example:"input": { "content": { "type": "image", "format": "base64", "value": "data:image/jpeg;base64,..." } }contentobject 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
contentobject 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
public final RequestEmbedding.Builder input(Function<EmbeddingInput.Builder, ObjectBuilder<EmbeddingInput>> fn) Required - Inference input. Either a string, an array of strings, acontentobject, or an array ofcontentobjects.contentobjects may contain a single item or an array of items. Models that support multiple items percontentobject will return a single embedding for eachcontentobject, regardless of how many items it contains. Support for multiple items in a singlecontentobject is available in Elasticsearch 9.5.0 and later.string example:
"input": "Some text"string array example:
"input": ["Some text", "Some more text"]contentobject example:"input": { "content": { "type": "image", "format": "base64", "value": "data:image/jpeg;base64,..." } }contentobject 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
contentobject 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
The input data type for the embedding model. Possible values include:SEARCHINGESTCLASSIFICATIONCLUSTERING
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_typeparameter specified on the root level of the request body will take precedence over theinput_typeparameter specified intask_settings.API name:
input_type -
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 -
self
- Specified by:
selfin classWithJsonObjectBuilderBase<RequestEmbedding.Builder>
-
build
Builds aRequestEmbedding.- Specified by:
buildin interfaceObjectBuilder<RequestEmbedding>- Throws:
NullPointerException- if some of the required fields are null.
-