Class ContentBlockDelta

    • Method Detail

      • text

        public final String text()

        The content text.

        Returns:
        The content text.
      • toolUse

        public final ToolUseBlockDelta toolUse()

        Information about a tool that the model is requesting to use.

        Returns:
        Information about a tool that the model is requesting to use.
      • hasToolResult

        public final boolean hasToolResult()
        For responses, this returns true if the service returned a value for the ToolResult property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • toolResult

        public final List<ToolResultBlockDelta> toolResult()

        An incremental update that contains the results from a tool call.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasToolResult() method.

        Returns:
        An incremental update that contains the results from a tool call.
      • reasoningContent

        public final ReasoningContentBlockDelta reasoningContent()

        Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.

        Returns:
        Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.
      • citation

        public final CitationsDelta citation()

        Incremental citation information that is streamed as part of the response generation process.

        Returns:
        Incremental citation information that is streamed as part of the response generation process.
      • image

        public final ImageBlockDelta image()

        A streaming delta event containing incremental image data.

        Returns:
        A streaming delta event containing incremental image data.
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • toString

        public final String toString()
        Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
        Overrides:
        toString in class Object
      • getValueForField

        public final <T> Optional<T> getValueForField​(String fieldName,
                                                      Class<T> clazz)
      • fromText

        public static ContentBlockDelta fromText​(String text)
        Create an instance of this class with text() initialized to the given value.

        The content text.

        Parameters:
        text - The content text.
      • fromToolUse

        public static ContentBlockDelta fromToolUse​(ToolUseBlockDelta toolUse)
        Create an instance of this class with toolUse() initialized to the given value.

        Information about a tool that the model is requesting to use.

        Parameters:
        toolUse - Information about a tool that the model is requesting to use.
      • fromToolUse

        public static ContentBlockDelta fromToolUse​(Consumer<ToolUseBlockDelta.Builder> toolUse)
        Create an instance of this class with toolUse() initialized to the given value.

        Information about a tool that the model is requesting to use.

        Parameters:
        toolUse - Information about a tool that the model is requesting to use.
      • fromToolResult

        public static ContentBlockDelta fromToolResult​(List<ToolResultBlockDelta> toolResult)
        Create an instance of this class with toolResult() initialized to the given value.

        An incremental update that contains the results from a tool call.

        Parameters:
        toolResult - An incremental update that contains the results from a tool call.
      • fromReasoningContent

        public static ContentBlockDelta fromReasoningContent​(ReasoningContentBlockDelta reasoningContent)
        Create an instance of this class with reasoningContent() initialized to the given value.

        Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.

        Parameters:
        reasoningContent - Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.
      • fromReasoningContent

        public static ContentBlockDelta fromReasoningContent​(Consumer<ReasoningContentBlockDelta.Builder> reasoningContent)
        Create an instance of this class with reasoningContent() initialized to the given value.

        Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.

        Parameters:
        reasoningContent - Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.
      • fromCitation

        public static ContentBlockDelta fromCitation​(CitationsDelta citation)
        Create an instance of this class with citation() initialized to the given value.

        Incremental citation information that is streamed as part of the response generation process.

        Parameters:
        citation - Incremental citation information that is streamed as part of the response generation process.
      • fromCitation

        public static ContentBlockDelta fromCitation​(Consumer<CitationsDelta.Builder> citation)
        Create an instance of this class with citation() initialized to the given value.

        Incremental citation information that is streamed as part of the response generation process.

        Parameters:
        citation - Incremental citation information that is streamed as part of the response generation process.
      • fromImage

        public static ContentBlockDelta fromImage​(ImageBlockDelta image)
        Create an instance of this class with image() initialized to the given value.

        A streaming delta event containing incremental image data.

        Parameters:
        image - A streaming delta event containing incremental image data.
      • fromImage

        public static ContentBlockDelta fromImage​(Consumer<ImageBlockDelta.Builder> image)
        Create an instance of this class with image() initialized to the given value.

        A streaming delta event containing incremental image data.

        Parameters:
        image - A streaming delta event containing incremental image data.