java.lang.Object
co.elastic.clients.elasticsearch.inference.Message
All Implemented Interfaces:
JsonpSerializable

@JsonpDeserializable public class Message extends Object implements JsonpSerializable
An object representing part of the conversation.
See Also:
  • Field Details

  • Method Details

    • of

    • content

      @Nullable public final MessageContent content()
      The content of the message.

      String example:

       {
          "content": "Some string"
       }
       
       

      Object example:

       {
         "content": [
             {
              "text": "Some text",
              "type": "text"
             }
          ]
       }
       
       

      API name: content

    • role

      public final String role()
      Required - The role of the message author. Valid values are user, assistant, system, and tool.

      API name: role

    • toolCallId

      @Nullable public final String toolCallId()
      Only for tool role messages. The tool call that this message is responding to.

      API name: tool_call_id

    • toolCalls

      public final List<ToolCall> toolCalls()
      Only for assistant role messages. The tool calls generated by the model. If it's specified, the content field is optional. Example:
       {
         "tool_calls": [
             {
                 "id": "call_KcAjWtAww20AihPHphUh46Gd",
                 "type": "function",
                 "function": {
                     "name": "get_current_weather",
                     "arguments": "{\"location\":\"Boston, MA\"}"
                 }
             }
         ]
       }
       
       

      API name: tool_calls

    • serialize

      public void serialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Serialize this object to JSON.
      Specified by:
      serialize in interface JsonpSerializable
    • serializeInternal

      protected void serializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setupMessageDeserializer

      protected static void setupMessageDeserializer(ObjectDeserializer<Message.Builder> op)