Class ToolResultContentBlock

    • Method Detail

      • json

        public final Document json()

        A tool result that is JSON format data.

        Returns:
        A tool result that is JSON format data.
      • text

        public final String text()

        A tool result that is text.

        Returns:
        A tool result that is text.
      • image

        public final ImageBlock image()

        A tool result that is an image.

        This field is only supported by Anthropic Claude 3 models.

        Returns:
        A tool result that is an image.

        This field is only supported by Anthropic Claude 3 models.

      • document

        public final DocumentBlock document()

        A tool result that is a document.

        Returns:
        A tool result that is a document.
      • 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)
      • fromJson

        public static ToolResultContentBlock fromJson​(Document json)
        Create an instance of this class with json() initialized to the given value.

        A tool result that is JSON format data.

        Parameters:
        json - A tool result that is JSON format data.
      • fromText

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

        A tool result that is text.

        Parameters:
        text - A tool result that is text.
      • fromImage

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

        A tool result that is an image.

        This field is only supported by Anthropic Claude 3 models.

        Parameters:
        image - A tool result that is an image.

        This field is only supported by Anthropic Claude 3 models.

      • fromImage

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

        A tool result that is an image.

        This field is only supported by Anthropic Claude 3 models.

        Parameters:
        image - A tool result that is an image.

        This field is only supported by Anthropic Claude 3 models.

      • fromDocument

        public static ToolResultContentBlock fromDocument​(DocumentBlock document)
        Create an instance of this class with document() initialized to the given value.

        A tool result that is a document.

        Parameters:
        document - A tool result that is a document.