Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
bytedance avatar

Byted Bytehouse Multimodal Search

  • 31 installs
  • 411 repo stars
  • Updated August 4, 2026
  • bytedance/agentkit-samples

Vectorizes text, images, and video and stores them in ByteHouse for multimodal vector storage and hybrid retrieval.

About

Handles multimodal vectorization and hybrid retrieval of text, image, and video data in ByteHouse. A developer uses it to store and search multimodal embeddings.

  • Text, image, and video vectorization
  • Multimodal storage and hybrid retrieval in ByteHouse

Byted Bytehouse Multimodal Search by the numbers

  • 31 all-time installs (skills.sh)
  • Ranked #500 of 911 Databases skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/bytedance/agentkit-samples --skill byted-bytehouse-multimodal-search

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs31
repo stars411
Last updatedAugust 4, 2026
Repositorybytedance/agentkit-samples

What it does

Vectorizes text, images, and video and stores them in ByteHouse for multimodal vector storage and hybrid retrieval.

Files

SKILL.mdMarkdownGitHub ↗

ByteHouse 多模态检索 Skill

🚀 快速开始

环境准备

pip install clickhouse-connect volcengine-python-sdk[ark] numpy

配置说明

配置保存在 ~/.bytehouse_config.json ,如果该文件存在且非空,则直接使用文件中的配置。如果不存在,则让用户提供ByteHouse连接信息( 把这个文档也发给客户,文档里面介绍了如何获取主机地址和密码:https://www.volcengine.com/docs/6517/1121919?lang=zh )。用户提供信息后,保存到json文件,避免重复向用户请求连接信息。当用户切换ByteHouse集群时,一并修改该文件。

{
   "BYTEHOUSE_HOST": "<ByteHouse-host>",
   "BYTEHOUSE_PORT": "8123",
   "BYTEHOUSE_USER": "bytehouse",
   "BYTEHOUSE_PASSWORD": "<ByteHouse-password>",
   "BYTEHOUSE_SECURE": true,
   "BYTEHOUSE_VERIFY": true, 
   "BH_ARK_API_KEY": "<火山引擎方舟API密钥>",
   "BH_ARK_BASE_URL": "https://ark.cn-beijing.volces.com/api/v3",
   "BH_EMBEDDING_MODEL": "doubao-embedding-vision-251215"
}

其中BYTEHOUSE_HOST(主机地址)和BYTEHOUSE_PASSWORD(密码)必须由用户提供。BH_ARK_API_KEY为可选配置,仅在embedding时使用,用户初次使用时可忽略。其余配置固定。

执行 scripts/export_config.sh 把配置信息导入环境变量中

source scripts/export_config.sh

---

📚 核心能力

1. 多模态向量化

基于豆包多模态向量化模型 doubao-embedding-vision-251215

输入类型支持格式最大限制
文本纯文本字符串无长度限制
图片JPG/PNG/GIF/WEBP/BMP<10MB,宽高>14px
视频MP4/AVI/MOV<50MB

关键约束

  • 多模态向量化必须调用 /embeddings/multimodal 接口
  • 图片/视频输入格式:{"type": "image_url", "image_url": {"url": "xxx"}}
  • 部分模型不支持 dimensions 参数

2. 向量检索功能

功能方法说明
纯向量检索vector_search()基于向量相似度检索
混合检索hybrid_search()向量+全文检索融合
以文搜图text_search_image()文本搜索图片
以图搜图image_search_image()图片搜索相似图片
以文搜视频text_search_video()文本搜索视频

---

📖 代码实现

完整示例代码实现位于 scripts/ 目录:

  • `scripts/embedding.py` - 多模态向量化模块
  • `scripts/search_client.py` - ByteHouse 检索客户端
  • `scripts/examples.py` - 使用示例
  • `scripts/export_config.sh` - 把配置文件中的信息导入环境变量

快速使用

from scripts import ByteHouseMultimodalSearch

# 初始化客户端
search = ByteHouseMultimodalSearch(connection_type="http")

# 创建表
search.create_multimodal_table("my_index")

# 插入文档
search.insert_document("my_index", doc_id=1, content_type="text", 
                      content="ByteHouse 多模态检索", title="介绍")

# 向量检索
results = search.vector_search("my_index", query_embedding=embedding, top_k=10)

---

⚙️ 最佳实践

索引选择

数据规模索引类型适用场景
<100万HNSW中小规模,低延迟
100万-1亿HNSW_SQ大规模,平衡性能成本
>1亿IVF_PQ_FS超大规模

性能优化

SETTINGS 
    index_granularity = 1024,
    index_granularity_bytes = 0,
    enable_vector_index_preload = 1

指令优化

场景Query 侧指令
通用文搜图Target_modality: image. Instruction:根据文本描述找到对应的图片.
电商商品检索Target_modality: image. Instruction:找到和描述匹配的同款商品图片.
原图检索Target_modality: image. Instruction:查找和本图完全相同的图片.

---

❓ 常见问题

Q1: 向量维度怎么选?

  • 推荐 2048 维作为通用值
  • 维度越高精度越高,但成本也越高

Q2: 如何处理低召回问题? 1. 增大 hnsw_ef_s 参数

Q3: API 调用失败排查

  • 404: 检查路径是否为 /embeddings/multimodal
  • 400: 检查输入格式,部分模型不支持 dimensions
  • 401: 检查 ARK_API_KEY 是否正确
  • 429: 降低请求频率

---

🔗 参考文档

Related skills

Databasesdatabasesanalytics

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.