Package datadog.trace.api.aiguard
Class AIGuard.ContentPart
java.lang.Object
datadog.trace.api.aiguard.AIGuard.ContentPart
- Enclosing class:
AIGuard
Represents a content part within a message. Content parts can be text or images, enabling
multimodal AI prompts.
Example usage:
// Text content
var textPart = AIGuard.ContentPart.text("Describe this image:");
// Image content from URL
var imagePart = AIGuard.ContentPart.imageUrl("https://example.com/image.jpg");
// Multimodal message with text and image
var message = AIGuard.Message.message("user", List.of(textPart, imagePart));
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionReturns the image URL of this part.getText()Returns the text content of this part.getType()Returns the type of this content part.static AIGuard.ContentPartCreates an image content part from a URL string.static AIGuard.ContentPartCreates a text content part.
-
Method Details
-
getType
Returns the type of this content part.- Returns:
- the content part type (TEXT or IMAGE_URL)
-
getText
Returns the text content of this part.- Returns:
- the text content, or null if this is an IMAGE_URL part
-
getImageUrl
Returns the image URL of this part.- Returns:
- the image URL, or null if this is a TEXT part
-
text
Creates a text content part.- Parameters:
text- the text content- Returns:
- a new ContentPart with TEXT type
- Throws:
NullPointerException- if text is null
-
imageUrl
Creates an image content part from a URL string.- Parameters:
url- the image URL or data URI- Returns:
- a new ContentPart with IMAGE_URL type
- Throws:
NullPointerException- if url is null
-