Class Message
java.lang.Object
co.elastic.clients.elasticsearch.inference.Message
- All Implemented Interfaces:
JsonpSerializable
An object representing part of the conversation.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<Message>Json deserializer forMessage -
Method Summary
Modifier and TypeMethodDescriptionfinal MessageContentcontent()The content of the message.static Messagefinal StringOnly forassistantrole messages.final List<ReasoningDetail>Only forassistantrole messages.rebuild()final Stringrole()Required - The role of the message author.voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected voidserializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static voidfinal StringOnly fortoolrole messages.Only forassistantrole messages.toString()
-
Field Details
-
_DESERIALIZER
Json deserializer forMessage
-
-
Method Details
-
of
-
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 -
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_calls -
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_details -
serialize
Serialize this object to JSON.- Specified by:
serializein interfaceJsonpSerializable
-
serializeInternal
-
toString
-
rebuild
- Returns:
- New
Message.Builderinitialized with field values of this instance
-
setupMessageDeserializer
-