Class Message.Builder
java.lang.Object
co.elastic.clients.util.ObjectBuilderBase
co.elastic.clients.util.WithJsonObjectBuilderBase<Message.Builder>
co.elastic.clients.elasticsearch.inference.Message.Builder
- All Implemented Interfaces:
WithJson<Message.Builder>,ObjectBuilder<Message>
- Enclosing class:
- Message
public static class Message.Builder
extends WithJsonObjectBuilderBase<Message.Builder>
implements ObjectBuilder<Message>
Builder for
Message.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aMessage.final Message.Buildercontent(MessageContent value) The content of the message.final Message.BuilderThe content of the message.final Message.BuilderOnly forassistantrole messages.final Message.BuilderreasoningDetails(ReasoningDetail value, ReasoningDetail... values) Only forassistantrole messages.final Message.BuilderOnly forassistantrole messages.final Message.BuilderreasoningDetails(List<ReasoningDetail> list) Only forassistantrole messages.final Message.BuilderRequired - The role of the message author.protected Message.Builderself()final Message.BuildertoolCallId(String value) Only fortoolrole messages.final Message.BuilderOnly forassistantrole messages.final Message.BuilderOnly forassistantrole messages.final Message.BuilderOnly forassistantrole messages.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
-
content
The content of the message.String example:
{ "content": "Some string" }Text example:
{ "content": [ { "text": "Some text", "type": "text" } ] }Image example:
{ "content": [ { "image_url": { "url": "data:image/jpeg;base64,..." }, "type": "image_url" } ] }File example:
{ "content": [ { "file": { "file_data": "data:application/pdf;base64,...", "filename": "somePDF" }, "type": "file" } ] }API name:
content -
content
public final Message.Builder content(Function<MessageContent.Builder, ObjectBuilder<MessageContent>> fn) The content of the message.String example:
{ "content": "Some string" }Text example:
{ "content": [ { "text": "Some text", "type": "text" } ] }Image example:
{ "content": [ { "image_url": { "url": "data:image/jpeg;base64,..." }, "type": "image_url" } ] }File example:
{ "content": [ { "file": { "file_data": "data:application/pdf;base64,...", "filename": "somePDF" }, "type": "file" } ] }API name:
content -
role
Required - The role of the message author. Valid values areuser,assistant,system, andtool.API name:
role -
toolCallId
Only fortoolrole messages. The tool call that this message is responding to.API name:
tool_call_id -
toolCalls
Only forassistantrole messages. The tool calls generated by the model. If it's specified, thecontentfield is optional. Example:{ "tool_calls": [ { "id": "call_KcAjWtAww20AihPHphUh46Gd", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"Boston, MA\"}" } } ] }API name:
tool_callsAdds all elements of
listtotoolCalls. -
toolCalls
Only forassistantrole messages. The tool calls generated by the model. If it's specified, thecontentfield is optional. Example:{ "tool_calls": [ { "id": "call_KcAjWtAww20AihPHphUh46Gd", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"Boston, MA\"}" } } ] }API name:
tool_callsAdds one or more values to
toolCalls. -
toolCalls
Only forassistantrole messages. The tool calls generated by the model. If it's specified, thecontentfield is optional. Example:{ "tool_calls": [ { "id": "call_KcAjWtAww20AihPHphUh46Gd", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"Boston, MA\"}" } } ] }API name:
tool_callsAdds a value to
toolCallsusing a builder lambda. -
reasoning
Only forassistantrole messages. The reasoning details generated by the model as plaintext. Currently supported only forelasticprovider.API name:
reasoning -
reasoningDetails
Only forassistantrole messages. The reasoning details generated by the model as structured data. Currently supported only forelasticprovider.API name:
reasoning_detailsAdds all elements of
listtoreasoningDetails. -
reasoningDetails
Only forassistantrole messages. The reasoning details generated by the model as structured data. Currently supported only forelasticprovider.API name:
reasoning_detailsAdds one or more values to
reasoningDetails. -
reasoningDetails
public final Message.Builder reasoningDetails(Function<ReasoningDetail.Builder, ObjectBuilder<ReasoningDetail>> fn) Only forassistantrole messages. The reasoning details generated by the model as structured data. Currently supported only forelasticprovider.API name:
reasoning_detailsAdds a value to
reasoningDetailsusing a builder lambda. -
self
- Specified by:
selfin classWithJsonObjectBuilderBase<Message.Builder>
-
build
Builds aMessage.- Specified by:
buildin interfaceObjectBuilder<Message>- Throws:
NullPointerException- if some of the required fields are null.
-