Class OpenAIContentPart
java.lang.Object
io.agentscope.extensions.model.openai.dto.OpenAIContentPart
OpenAI content part DTO for multimodal messages.
Each content part has a type and corresponding data: - "text" type with text field - "image_url" type with image_url field - "video_url" type with video_url field - "input_audio" type with input_audio field
Example text part:
{"type": "text", "text": "What's in this image?"}
Example image part:
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
Example video part:
{"type": "video_url", "videoUrl": {"url": "https://example.com/video.mp4"}}
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenAIContentPart.Builderbuilder()Get the cache control configuration.getText()getType()static OpenAIContentPartCreate an image content part.static OpenAIContentPartCreate an image content part with detail level.static OpenAIContentPartinputAudio(String data, String format) Create an audio content part.voidsetCacheControl(Map<String, String> cacheControl) Set the cache control configuration.voidsetImageUrl(OpenAIImageUrl imageUrl) voidsetInputAudio(OpenAIInputAudio inputAudio) voidvoidvoidsetVideoUrl(OpenAIVideoUrl videoUrl) static OpenAIContentPartCreate a text content part.static OpenAIContentPartCreate a video content part.
-
Constructor Details
-
OpenAIContentPart
public OpenAIContentPart()
-
-
Method Details
-
getType
-
setType
-
getText
-
setText
-
getImageUrl
-
setImageUrl
-
getInputAudio
-
setInputAudio
-
getVideoUrl
-
setVideoUrl
-
getCacheControl
Get the cache control configuration.- Returns:
- the cache control configuration, or null when not configured
-
setCacheControl
Set the cache control configuration.- Parameters:
cacheControl- the cache control configuration
-
text
Create a text content part.- Parameters:
text- the text content- Returns:
- a new OpenAIContentPart
-
imageUrl
Create an image content part.- Parameters:
url- the image URL or base64 data URI- Returns:
- a new OpenAIContentPart
-
imageUrl
Create an image content part with detail level.- Parameters:
url- the image URL or base64 data URIdetail- the detail level ("low", "high", or "auto")- Returns:
- a new OpenAIContentPart
-
inputAudio
Create an audio content part.- Parameters:
data- the base64-encoded audio dataformat- the audio format (e.g., "wav", "mp3")- Returns:
- a new OpenAIContentPart
-
videoUrl
Create a video content part.- Parameters:
url- the video URL or base64 data URI- Returns:
- a new OpenAIContentPart
-
builder
-