OpenAIContentPart
@JsonInclude(JsonInclude.Include.NON_NULL) public class OpenAIContentPart
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:46–250用于多模态消息的OpenAI 内容片段 DTO。位于 io.agentscope.extensions.model.openai.dto 包。核心成员包括 getType、setType、getText、setText、getImageUrl、setImageUrl。
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
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 A class in io.agentscope.extensions.model.openai.dto that talks to model services and returns generated or embedded output. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public OpenAIContentPart() | 初始化 `OpenAIContentPart` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
OpenAIContentPart
public OpenAIContentPart()
初始化 OpenAIContentPart 实例。
Creates a new instance.
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:74方法详情Method Detail
getType
public String getType()
获取类型。
Returns the type.
Stringio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:76–78setType
public void setType(String type)
设置类型。
Sets the type.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
type | String | 类型(类型 `String`)。The type. |
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:80–82getText
public String getText()
获取文本。
Returns the text.
Stringio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:84–86setText
public void setText(String text)
设置文本。
Sets the text.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text | String | 文本(类型 `String`)。The text. |
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:88–90getImageUrl
public OpenAIImageUrl getImageUrl()
获取图像 URL。
Returns the image url.
OpenAIImageUrlio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:92–94setImageUrl
public void setImageUrl(OpenAIImageUrl imageUrl)
设置图像 URL。
Sets the image url.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
imageUrl | OpenAIImageUrl | 图像 URL(类型 `OpenAIImageUrl`)。The image url. |
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:96–98getInputAudio
public OpenAIInputAudio getInputAudio()
获取输入音频。
Returns the input audio.
OpenAIInputAudioio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:100–102setInputAudio
public void setInputAudio(OpenAIInputAudio inputAudio)
设置输入音频。
Sets the input audio.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
inputAudio | OpenAIInputAudio | 输入音频(类型 `OpenAIInputAudio`)。The input audio. |
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:104–106getVideoUrl
public OpenAIVideoUrl getVideoUrl()
获取视频 URL。
Returns the video url.
OpenAIVideoUrlio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:108–110setVideoUrl
public void setVideoUrl(OpenAIVideoUrl videoUrl)
设置视频 URL。
Sets the video url.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
videoUrl | OpenAIVideoUrl | 视频 URL(类型 `OpenAIVideoUrl`)。The video url. |
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:112–114getCacheControl
public Map<String, String> getCacheControl()
获取 getCacheControl。
Get the cache control configuration.
Map<String, String>io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:121–123setCacheControl
public void setCacheControl(Map<String, String> cacheControl)
设置 setCacheControl。
Set the cache control configuration.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
cacheControl | Map<String, String> | 缓存 Control(类型 `Map`)。the cache control configuration |
io/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:130–132text
public static OpenAIContentPart text(String text)
创建文本内容片段。
Create a text content part.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text | String | 文本内容。the text content |
OpenAIContentPartio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:140–145imageUrl
public static OpenAIContentPart imageUrl(String url)
创建图像内容片段。
Create an image content part.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
url | String | 图像 URL 或 base64 数据 URI。the image URL or base64 data URI |
OpenAIContentPartio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:153–158imageUrl
public static OpenAIContentPart imageUrl(String url, String detail)
创建图像内容片段使用详情级别。
Create an image content part with detail level.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
url | String | 图像 URL 或 base64 数据 URI。the image URL or base64 data URI |
detail | String | 详情(类型 `String`)。the detail level ("low", "high", or "auto") |
OpenAIContentPartio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:167–172inputAudio
public static OpenAIContentPart inputAudio(String data, String format)
创建音频内容片段。
Create an audio content part.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
data | String | Base64 编码的音频数据。the base64-encoded audio data |
format | String | 格式(类型 `String`)。the audio format (e.g., "wav", "mp3") |
OpenAIContentPartio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:181–186videoUrl
public static OpenAIContentPart videoUrl(String url)
创建视频内容片段。
Create a video content part.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
url | String | 视频 URL 或 base64 数据 URI。the video URL or base64 data URI |
OpenAIContentPartio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:194–199builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/agentscope/extensions/model/openai/dto/OpenAIContentPart.java:201–203嵌套类详情Nested Class Detail
Builder
public static class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.model.openai.dto 包。核心成员包括 type、text、imageUrl、inputAudio、videoUrl、cacheControl。
A class in io.agentscope.extensions.model.openai.dto that talks to model services and returns generated or embedded output. Declared in io.agentscope.extensions.model.openai.dto.