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.Builder
content
(MessageContent value) The content of the message.final Message.Builder
The content of the message.final Message.Builder
Required - The role of the message author.protected Message.Builder
self()
final Message.Builder
toolCallId
(String value) Only fortool
role messages.final Message.Builder
Only forassistant
role messages.final Message.Builder
Only forassistant
role messages.final Message.Builder
Only forassistant
role messages.Methods inherited from class co.elastic.clients.util.WithJsonObjectBuilderBase
withJson
Methods 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" }
Object example:
{ "content": [ { "text": "Some text", "type": "text" } ] }
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" }
Object example:
{ "content": [ { "text": "Some text", "type": "text" } ] }
API name:
content
-
role
Required - The role of the message author. Valid values areuser
,assistant
,system
, andtool
.API name:
role
-
toolCallId
Only fortool
role messages. The tool call that this message is responding to.API name:
tool_call_id
-
toolCalls
Only forassistant
role messages. The tool calls generated by the model. If it's specified, thecontent
field is optional. Example:{ "tool_calls": [ { "id": "call_KcAjWtAww20AihPHphUh46Gd", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"Boston, MA\"}" } } ] }
API name:
tool_calls
Adds all elements of
list
totoolCalls
. -
toolCalls
Only forassistant
role messages. The tool calls generated by the model. If it's specified, thecontent
field is optional. Example:{ "tool_calls": [ { "id": "call_KcAjWtAww20AihPHphUh46Gd", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"Boston, MA\"}" } } ] }
API name:
tool_calls
Adds one or more values to
toolCalls
. -
toolCalls
Only forassistant
role messages. The tool calls generated by the model. If it's specified, thecontent
field is optional. Example:{ "tool_calls": [ { "id": "call_KcAjWtAww20AihPHphUh46Gd", "type": "function", "function": { "name": "get_current_weather", "arguments": "{\"location\":\"Boston, MA\"}" } } ] }
API name:
tool_calls
Adds a value to
toolCalls
using a builder lambda. -
self
- Specified by:
self
in classWithJsonObjectBuilderBase<Message.Builder>
-
build
Builds aMessage
.- Specified by:
build
in interfaceObjectBuilder<Message>
- Throws:
NullPointerException
- if some of the required fields are null.
-