Class ContentUtils

java.lang.Object
uno.anahata.ai.internal.ContentUtils

public final class ContentUtils extends Object
Utility methods for working with the Google GenAI Content object.
Author:
Anahata
  • Constructor Details

    • ContentUtils

      public ContentUtils()
  • Method Details

    • cloneAndRemoveParts

      public static com.google.genai.types.Content cloneAndRemoveParts(com.google.genai.types.Content original, List<com.google.genai.types.Part> partsToRemove)
      Creates a new Content object that is a clone of the original, but with a list of specific Parts removed.

      This is useful for pruning operations where specific parts of a message need to be discarded while preserving the rest of the content and the role.

      Parameters:
      original - The original Content object.
      partsToRemove - The list of Parts to exclude from the new object.
      Returns:
      A new Content object without the specified parts, or the original if no parts were removed.