Skip to content

feat: add explicit dimension and other params to MultiModalEmbeddingParam - #273

Merged
luk384090-cloud merged 2 commits into
mainfrom
dev/issues-9
Sep 17, 2026
Merged

luk384090-cloud merged 2 commits into
mainfrom
dev/issues-9

Conversation

@lzsweb

@lzsweb lzsweb commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

背景

Closes #272

用户反馈调用 Multimodal-Embedding 做图片向量化时无法设置维度(expected 1152 dimensions, not 1024),MultiModalEmbeddingParam 未提供显式的 dimension 字段。

改动

MultiModalEmbeddingParam 补齐与 Python SDK 对齐的显式参数(复用 TextEmbeddingParam 的既有模式):

新增字段 请求参数 说明
dimension dimension 输出向量维度(按模型支持,vision 系列默认 1152)
outputType output_type 目前仅 "dense"
fps fps 视频抽帧率 [0,1]
instruct instruct 自定义任务指令
enableFusion enable_fusion 仅 qwen3-vl-embedding,多内容融合为单向量
resLevel res_level 分辨率档位
maxVideoFrames max_video_frames 视频最大抽帧数
  • 重写 getParameters():显式字段序列化进 parameters;通用 .parameter(k, v) 通道保持可用且优先级更高(向后兼容,旧代码不受影响)
  • getHttpBody() 改用 getParameters()

用法

MultiModalEmbeddingParam.builder()
        .model("tongyi-embedding-vision-plus")
        .contents(contents)
        .dimension(1152)   // ← 新显式 API
        .build();

测试

新增 TestMultiModalEmbeddingParam(4 个用例):dimension 序列化 / 7 参数全量序列化 / 通用 .parameter() 兼容 / 无参数不注入多余键。

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0 — BUILD SUCCESS

…aram

Align MultiModalEmbeddingParam with Python SDK by exposing dimension,
output_type, fps, instruct, enable_fusion, res_level and max_video_frames
as explicit builder fields. Generic .parameter() channel still takes
precedence for backward compatibility. Add unit tests for serialization.
- 更新 pom.xml 中的版本号
- 更新 Version.java 中的版本号
@luk384090-cloud
luk384090-cloud merged commit 9db8553 into main Sep 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MultiModalEmbedding 怎么设置维度

2 participants