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.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" }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 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. -
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.
-