OpenAIConverterUtils
public final class OpenAIConverterUtils
源码Source
io/agentscope/extensions/model/openai/formatter/OpenAIConverterUtils.java:25–115OpenAI 转换器 Utils,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.openai.formatter 包。核心成员包括 convertImageSourceToUrl、detectAudioFormat、convertVideoSourceToUrl。
Utility class for OpenAI message and conversation conversion.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static String convertImageSourceToUrl(Source source)static | 转换图像来源到 URL。 Convert an image source to a URL string. |
public static String detectAudioFormat(String mediaType)static | 设置该参数。 Detect audio format from media type. |
public static String convertVideoSourceToUrl(Source source)static | 转换视频来源到 URL。 Convert a video source to a URL string. |
方法详情Method Detail
convertImageSourceToUrl
public static String convertImageSourceToUrl(Source source)
static
转换图像来源到 URL。
Convert an image source to a URL string.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
source | Source | 图像来源(URLSource 或 Base64Source)。The image source (URLSource or Base64Source) |
String返回字符串结果。The URL string or data URI
IllegalArgumentException可能抛出 `IllegalArgumentException`。if source is null or of unknown type
源码Source
io/agentscope/extensions/model/openai/formatter/OpenAIConverterUtils.java:38–60detectAudioFormat
public static String detectAudioFormat(String mediaType)
static
设置该参数。
Detect audio format from media type.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
mediaType | String | media 类型(类型 `String`)。The media type (e.g., "audio/wav") |
String返回字符串结果。The format string (e.g., "wav")
源码Source
io/agentscope/extensions/model/openai/formatter/OpenAIConverterUtils.java:68–83convertVideoSourceToUrl
public static String convertVideoSourceToUrl(Source source)
static
转换视频来源到 URL。
Convert a video source to a URL string.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
source | Source | 视频来源(URLSource 或 Base64Source)。The video source (URLSource or Base64Source) |
String返回字符串结果。The URL string or data URI
IllegalArgumentException可能抛出 `IllegalArgumentException`。if source is null or of unknown type
源码Source
io/agentscope/extensions/model/openai/formatter/OpenAIConverterUtils.java:92–114