OllamaMediaConverter
public class OllamaMediaConverter
源码Source
io/agentscope/extensions/model/ollama/formatter/OllamaMediaConverter.java:31–73Ollama Media 转换器,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.ollama.formatter 包。核心成员包括 convertImageBlockToBase64。
Handles media content conversion for Ollama API. Converts ImageBlock to Base64 strings as required by Ollama.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String convertImageBlockToBase64(ImageBlock imageBlock) throws Exception | 转换图像块到基类 64。 Convert ImageBlock to Base64 string for Ollama API. |
方法详情Method Detail
convertImageBlockToBase64
public String convertImageBlockToBase64(ImageBlock imageBlock) throws Exception
转换图像块到基类 64。
Convert ImageBlock to Base64 string for Ollama API.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
imageBlock | ImageBlock | 图像块到转换。The image block to convert |
String返回字符串结果。Base64 encoded string of the image
Exception可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/extensions/model/ollama/formatter/OllamaMediaConverter.java:50–72