On this page
article
Google-multimodal
1.概述
多模态嵌入模型会根据您提供的输入生成 1408 维向量,这些输入可以包含图像、文本和视频数据的组合。这些嵌入向量随后可用于图像分类或视频内容审核等后续任务。 图像嵌入向量和文本嵌入向量位于同一语义空间,且维度相同。因此,在诸如通过文本搜索图像或通过图像搜索视频等应用场景中,这两个向量可以互换使用
模型列表:
multimodalembedding@001
2.请求说明
- 请求方法:
POST - 请求地址
https://gateway.theturbo.ai/v1/publishers/google/models/{model}:predic
3.请求参数
3.1 Head参数
| 参数名称 | 类型 | 必填 | 说明 | 示例值 |
|---|---|---|---|---|
Content-Type |
string | 是 | 设置请求头类型,必须为application/json |
application/json |
x-goog-api-key |
string | 是 | 身份验证所需的 API_KEY,格式$YOUR_API_KEY |
$YOUR_API_KEY |
3.2 Body 参数 (application/json)
instances 参数
| 参数名称 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| text | string | 否 | 输入文本内容。 | 你好,请给我讲个笑话。 |
| image.bytesBase64Encoded | string | 否 | 输入图片内容。需要base64处理 |
parameters 参数
| 参数名称 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| dimension | int | 是 | 嵌入维数。128 256 512 1408 |
1408 |
4、请求示例
curl https://gateway.theturbo.ai/v1/publishers/google/models/multimodalembedding@001:predict \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $YOUR_API_KEY" \
-d '{
"instances": [
{
"text": "你好,请给我讲个笑话",
"image": {
"bytesBase64Encoded": "***"
}
}
],
"parameters": {
"dimension": 128
}
}'
5、响应示例
{
"predictions": [
{
"imageEmbedding": [
0.0279239565,
[...128 dimension vector...]
0.00403284049
],
"textEmbedding": [
0.202921599,
[...128 dimension vector...]
-0.0365431122
]
}
]
}