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 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" }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_calls -
serialize
Serialize this object to JSON.- Specified by:
serializein interfaceJsonpSerializable
-
serializeInternal
-
toString
-
setupMessageDeserializer
-