public static class AIGuard.ContentPart extends Object
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));
| Modifier and Type | Class and Description |
|---|---|
static class |
AIGuard.ContentPart.Type
Type of content part.
|
| Modifier and Type | Method and Description |
|---|---|
AIGuard.ImageURL |
getImageUrl()
Returns the image URL of this part.
|
String |
getText()
Returns the text content of this part.
|
AIGuard.ContentPart.Type |
getType()
Returns the type of this content part.
|
static AIGuard.ContentPart |
imageUrl(String url)
Creates an image content part from a URL string.
|
static AIGuard.ContentPart |
text(String text)
Creates a text content part.
|
@Nonnull public AIGuard.ContentPart.Type getType()
@Nullable public String getText()
@Nullable public AIGuard.ImageURL getImageUrl()
@Nonnull public static AIGuard.ContentPart text(@Nonnull String text)
text - the text contentNullPointerException - if text is null@Nonnull public static AIGuard.ContentPart imageUrl(@Nonnull String url)
url - the image URL or data URINullPointerException - if url is null