Base64Source
public class Base64Source extends Source
io/agentscope/core/message/Base64Source.java:39–128基类 64 来源,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.message 包,继承自 Source。核心成员包括 getMediaType、getData、builder、Base64Source。
Represents Base64-encoded media content with media type and data.
This source is used for embedding media files directly in messages by encoding the binary data as Base64 strings. The format follows the standard MIME type convention with Base64 encoding.
Common media types include:
-
image/jpeg, image/png, image/gif - for images
-
audio/mpeg, audio/wav, audio/ogg - for audio
-
video/mp4, video/avi, video/mov - for video
This approach is useful when media files need to be included directly in messages rather than referenced by URL.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 Builder for constructing Base64Source instances. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public Base64Source(String mediaType, String data) | 初始化 `Base64Source` 实例。 Creates a new Base64 source for JSON deserialization. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getMediaType() | 获取 `getMediaType`。 Gets the MIME type of the media content. |
public String getData() | 获取数据。 Gets the Base64-encoded media data. |
public static Builder builder()static | 返回构建器实例。 Creates a new builder for constructing Base64Source instances. |
构造器详情Constructor Detail
Base64Source
public Base64Source(String mediaType, String data)
初始化 Base64Source 实例。
Creates a new Base64 source for JSON deserialization.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
mediaType | String | media 类型(类型 `String`)。The MIME type of the media content (e.g., "image/jpeg") |
data | String | 数据(类型 `String`)。The Base64-encoded media data |
NullPointerException可能抛出 `NullPointerException`。if mediaType or data is null
io/agentscope/core/message/Base64Source.java:53–58方法详情Method Detail
getMediaType
public String getMediaType()
获取 getMediaType。
Gets the MIME type of the media content.
Stringio/agentscope/core/message/Base64Source.java:65–67getData
public String getData()
获取数据。
Gets the Base64-encoded media data.
Stringio/agentscope/core/message/Base64Source.java:74–76builder
public static Builder builder()
返回构建器实例。
Creates a new builder for constructing Base64Source instances.
Builderio/agentscope/core/message/Base64Source.java:83–85嵌套类详情Nested Class Detail
Builder
public static class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.core.message 包。核心成员包括 mediaType、data、build。
Builder for constructing Base64Source instances.