byted-bytehouse-ai-query 描述 ByteHouse AI Query Skill,提供 Text2SQL 接口能力,支持将自然语言转换为 SQL 并执行查询。 核心能力 : 1. Text2SQL - 将自然语言描述的查询需求转换为 ByteHouse SQL 语句 2. List Tables - 列出数据库中的表 3. Execute SQL - 执行 SQL 查询并返回结果 4. 多模态向量化 - 支持文本、图片、视频的向量化存储和混合检索 📁 文件说明 - SKILL.md - 本文件,技能主文档 - init config.py - 初始化配置文件脚本 - text2sql.py - Text2SQL 转换脚本 - list tables.py - 列出数据库中的表 - execute sql.py - 执行 SQL 查询脚本 - embedding.py - 多模态向量化脚本 - search client.py - 向量检索客户端脚本(使用ByteHouse向量检索) - export config.sh - 配置导出环境变量脚本(从 /.bytehouse config.json读取) 把这个文档也发给客户,文档里面介绍了如何获取主机地址和密码:https://www.volcengine.com/docs/6517/1121919?la…

, '', sql)\n \n # 规范化空白字符\n sql = re.sub(r'\\s+', ' ', sql)\n sql = sql.strip()\n \n return sql\n\ndef main():\n \"\"\"命令行入口\"\"\"\n parser = argparse.ArgumentParser(\n description='ByteHouse Text2SQL - 将自然语言转换为 SQL 查询',\n formatter_class=argparse.RawDescriptionHelpFormatter,\n epilog='''\n示例:\n python3 text2sql.py \"get count of queries\" \"bytehouse.query_history\"\n python3 text2sql.py \"查看最近10条记录\" \"bytehouse.query_history\" --config '{\"reasoningModel\": \"ep-xxx\", \"reasoningAPIKey\": \"xxx\", \"url\": \"https://xxx\"}'\n\n环境变量:\n BYTEHOUSE_HOST - ByteHouse 主机 (如 tenant-xxx-cn-beijing-public.bytehouse.volces.com)\n BYTEHOUSE_PASSWORD - 密码 (作为 Bearer token)\n\n自定义 Config (通过 --config 参数):\n reasoningModel - 自定义模型ID\n reasoningAPIKey - 自定义 API Key\n url - 自定义 API URL\n'''\n )\n \n parser.add_argument('query', help='自然语言查询')\n parser.add_argument('tables', nargs='+', help='要查询的表名列表')\n parser.add_argument('--config', type=str, help='JSON 格式的配置,包含 reasoningModel, reasoningAPIKey, url')\n parser.add_argument('--system-hints', type=str, default='TEXT2SQL', help='系统提示词 (默认: TEXT2SQL)')\n \n args = parser.parse_args()\n \n # 解析 config 参数\n config = None\n if args.config:\n try:\n config = json.loads(args.config)\n except json.JSONDecodeError as e:\n print(f\"Error: Invalid JSON in --config: {e}\", file=sys.stderr)\n sys.exit(1)\n \n # 检查必要配置\n if not config and not BYTEHOUSE_HOST:\n print(\"Error: Please set BYTEHOUSE_HOST environment variable or provide --config\", file=sys.stderr)\n sys.exit(1)\n \n try:\n sql = call_text2sql(args.query, args.tables, args.system_hints, config)\n print(sql)\n except Exception as e:\n print(f\"Error: {e}\", file=sys.stderr)\n sys.exit(1)\n\n\nif __name__ == \"__main__\":\n main()","content_type":"text/x-python; charset=utf-8","language":"python","size":7696,"content_sha256":"fd81153dcf90374ecdb280b89198fbd687e22f203faafa89e3cbc39061255bf9"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"byted-bytehouse-ai-query","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"描述","type":"text"}]},{"type":"paragraph","content":[{"text":"ByteHouse AI Query Skill,提供 Text2SQL 接口能力,支持将自然语言转换为 SQL 并执行查询。","type":"text"}]},{"type":"paragraph","content":[{"text":"核心能力","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Text2SQL","type":"text","marks":[{"type":"strong"}]},{"text":" - 将自然语言描述的查询需求转换为 ByteHouse SQL 语句","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"List Tables","type":"text","marks":[{"type":"strong"}]},{"text":" - 列出数据库中的表","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Execute SQL","type":"text","marks":[{"type":"strong"}]},{"text":" - 执行 SQL 查询并返回结果","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"多模态向量化","type":"text","marks":[{"type":"strong"}]},{"text":" - 支持文本、图片、视频的向量化存储和混合检索","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"📁 文件说明","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"SKILL.md","type":"text","marks":[{"type":"strong"}]},{"text":" - 本文件,技能主文档","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"init_config.py","type":"text","marks":[{"type":"strong"}]},{"text":" - 初始化配置文件脚本","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"text2sql.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Text2SQL 转换脚本","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"list_tables.py","type":"text","marks":[{"type":"strong"}]},{"text":" - 列出数据库中的表","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"execute_sql.py","type":"text","marks":[{"type":"strong"}]},{"text":" - 执行 SQL 查询脚本","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"embedding.py","type":"text","marks":[{"type":"strong"}]},{"text":" - 多模态向量化脚本","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"search_client.py","type":"text","marks":[{"type":"strong"}]},{"text":" - 向量检索客户端脚本(使用ByteHouse向量检索)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"export_config.sh","type":"text","marks":[{"type":"strong"}]},{"text":" - 配置导出环境变量脚本(从~/.bytehouse_config.json读取)","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"把这个文档也发给客户,文档里面介绍了如何获取主机地址和密码:https://www.volcengine.com/docs/6517/1121919?lang=zh","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"配置说明","type":"text"}]},{"type":"paragraph","content":[{"text":"配置保存在 ","type":"text"},{"text":"~/.bytehouse_config.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" ,如果该文件存在且非空,则直接使用文件中的配置。如果不存在,则让用户提供ByteHouse连接信息( 把这个文档也发给客户,文档里面介绍了如何获取主机地址和密码:https://www.volcengine.com/docs/6517/1121919?lang=zh )。用户提供信息后,保存到json文件,避免重复向用户请求连接信息。当用户切换ByteHouse集群时,一并修改该文件。","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"BYTEHOUSE_HOST\": \"\u003cByteHouse-host>\",\n \"BYTEHOUSE_PORT\": \"8123\",\n \"BYTEHOUSE_USER\": \"bytehouse\",\n \"BYTEHOUSE_PASSWORD\": \"\u003cByteHouse-password>\",\n \"BYTEHOUSE_SECURE\": true,\n \"BYTEHOUSE_VERIFY\": true, \n \"BH_ARK_API_KEY\": \"\u003c火山引擎方舟API密钥>\",\n \"BH_ARK_BASE_URL\": \"https://ark.cn-beijing.volces.com/api/v3\",\n \"BH_EMBEDDING_MODEL\": \"doubao-embedding-vision-251215\"\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"其中BYTEHOUSE_HOST(主机地址)和BYTEHOUSE_PASSWORD(密码)","type":"text"},{"text":"必须由","type":"text","marks":[{"type":"strong"}]},{"text":"用户提供。BH_ARK_API_KEY为可选配置,仅在embedding时使用,用户初次使用时可忽略。其余配置固定。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"使用限制","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"风险预警:如果Text2SQL生成的SQL不是DQL类型(例如 INSERT/UPDATE/DROP 等 DML/DDL),AI助手","type":"text"},{"text":"必须首先阻断执行","type":"text","marks":[{"type":"strong"}]},{"text":",向用户展示生成的具体SQL,并明确询问用户是否确认执行。","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"当作为AI助手调用 ","type":"text"},{"text":"execute_sql.py","type":"text","marks":[{"type":"code_inline"}]},{"text":" 执行非DQL时,脚本会默认报错并提示需要确认。","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"只有在用户明确同意执行后,AI助手才可以通过在调用命令中附加 ","type":"text"},{"text":"--force","type":"text","marks":[{"type":"code_inline"}]},{"text":" 参数(例如 ","type":"text"},{"text":"python3 scripts/execute_sql.py \"DROP TABLE xxx\" --force","type":"text","marks":[{"type":"code_inline"}]},{"text":")来强制执行。","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"结果呈现:默认展示前5条符合查询条件的结果,如果返回异常,展示具体的报错信息","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"用户询问任何数据或者资产相关的问题,总是执行SQL查询后返回结果,不要根据上下文猜答案","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"不要直接输出敏感信息,如密码、Key等,确实需要输出时,需要Mask处理","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"前置条件","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Python 3.8+","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"uv (已安装在 ","type":"text"},{"text":"/root/.local/bin/uv","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ByteHouse连接信息(保存在","type":"text"},{"text":"~/.bytehouse_config.json","type":"text","marks":[{"type":"code_inline"}]},{"text":",如果不存在,让用户先提供)","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"🚀 快速开始","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"1. 把ByteHouse连接信息导出到环境变量","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 从配置文件读取配置,导出到环境变量\nsource scripts/export_config.sh","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"2. 列出数据库和表","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 列出所有数据库\npython3 scripts/list_tables.py --databases\n\n# 列出指定数据库的表\npython3 scripts/list_tables.py --database tpcds","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"3. 使用 Text2SQL","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 执行 Text2SQL\npython3 scripts/text2sql.py \"get count of all call centers\" \"tpcds.call_center\"","type":"text"}]},{"type":"paragraph","content":[{"text":"返回:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"sql"},"content":[{"text":"SELECT COUNT(*) AS call_center_count FROM tpcds.call_center;","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"4. 执行 SQL 查询","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 scripts/execute_sql.py \"SELECT * FROM tpcds.call_center LIMIT 5\"\npython3 scripts/execute_sql.py \"SELECT count(*) FROM tpcds.store_sales\" --format pretty","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"5. 完整流程:Text2SQL + Execute","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 1. 先获取 SQL\nSQL=$(python3 text2sql.py \"get count of call centers\" \"tpcds.call_center\")\n\n# 2. 执行 SQL\npython3 scripts/execute_sql.py \"$SQL\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"6. 多模态向量化","type":"text"}]},{"type":"paragraph","content":[{"text":"需要向量化多模态内容(文本、图片、视频),请使用以下脚本:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"scripts/embedding.py","type":"text","marks":[{"type":"link","attrs":{"href":"scripts/embedding.py","title":null}},{"type":"code_inline"}]},{"text":" - 多模态向量化模块","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"scripts/multimodal_search_client.py","type":"text","marks":[{"type":"link","attrs":{"href":"scripts/multimodal_search_client.py","title":null}},{"type":"code_inline"}]},{"text":" - ByteHouse 检索客户端","type":"text"}]}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"from scripts import ByteHouseMultimodalSearch\n\n# 初始化客户端\nsearch = ByteHouseMultimodalSearch(connection_type=\"http\")\n\n# 创建表\nsearch.create_multimodal_table(\"my_index\")\n\n# 插入文档\nsearch.insert_document(\"my_index\", doc_id=1, content_type=\"text\", \n content=\"ByteHouse 多模态检索\", title=\"介绍\")\n\n# 向量检索(需要过滤0维向量,否则会报错)\nquery_embedding = search.embedding.encode_text(\"云原生数据仓库\")\nresults = search.vector_search(\"my_index\", query_embedding=query_embedding, top_k=10)","type":"text"}]},{"type":"paragraph","content":[{"text":"🔗 参考文档","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ByteHouse 向量检索SQL文档","type":"text","marks":[{"type":"link","attrs":{"href":"https://www.volcengine.com/docs/6464/1208707","title":null}}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"火山引擎多模态向量化API文档","type":"text","marks":[{"type":"link","attrs":{"href":"https://www.volcengine.com/docs/82379/1409291","title":null}}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"💻 程序化调用","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Text2SQL + Execute 一体化","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"import subprocess\nimport json\n\ndef ai_query(natural_language: str, tables: list, config: dict = None) -> str:\n \"\"\"\n 调用 Text2SQL 并执行查询\n \n Args:\n natural_language: 自然语言描述\n tables: 要查询的表名列表\n config: 可选的配置 dict\n \n Returns:\n 查询结果\n \"\"\"\n # 1. 获取 SQL\n cmd = [\"python3\", \"text2sql.py\", natural_language] + tables\n if config:\n cmd.extend([\"--config\", json.dumps(config)])\n \n sql_result = subprocess.run(cmd, capture_output=True, text=True)\n sql = sql_result.stdout.strip()\n \n if not sql:\n return f\"Text2SQL failed: {sql_result.stderr}\"\n \n # 2. 执行 SQL\n result = subprocess.run(\n [\"python3\", \"execute_sql.py\", sql],\n capture_output=True,\n text=True\n )\n \n return result.stdout\n\n# 使用示例\nresult = ai_query(\"get count of call centers\", [\"tpcds.call_center\"])\nprint(result)","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"API 参考","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Text2SQL 请求参数","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"参数","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"类型","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"必填","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"说明","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"systemHints","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"string","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"系统提示词,默认为 \"TEXT2SQL\"","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"input","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"string","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"是","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"自然语言查询","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"knowledgeBaseIDsString","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"string[]","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"知识库ID列表,默认 [\"*\"]","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"tables","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"string[]","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"是","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"要查询的表名列表","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"config","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"object","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"自定义配置","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"config.reasoningModel","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"string","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"自定义模型ID","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"config.reasoningAPIKey","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"string","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"自定义 API Key","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"config.url","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"string","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"自定义 API URL","type":"text"}]}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"byted-bytehouse-ai-query","author":"@skillopedia","source":{"stars":345,"repo_name":"agentkit-samples","origin_url":"https://github.com/bytedance/agentkit-samples/blob/HEAD/skills/byted-bytehouse-ai-query/SKILL.md","repo_owner":"bytedance","body_sha256":"1295a1b0774cfca752faf19a695adf37187c9f9f3d10b9e7163a33588f7297fa","cluster_key":"fce2a6f89a06915d98b3f99d187badaab21bb4f04a5acc33ec12912a4c8ab19e","clean_bundle":{"format":"clean-skill-bundle-v1","source":"bytedance/agentkit-samples/skills/byted-bytehouse-ai-query/SKILL.md","attachments":[{"id":"2132db99-a5c7-5613-b606-ace7545c2b2f","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/2132db99-a5c7-5613-b606-ace7545c2b2f/attachment.py","path":"scripts/client.py","size":3347,"sha256":"b0759174904fff64598ea4c2a9700ef11c780ea334bd34fbe180037241af17d1","contentType":"text/x-python; charset=utf-8"},{"id":"7d2aa483-7d91-5415-8440-df436ae29931","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/7d2aa483-7d91-5415-8440-df436ae29931/attachment.py","path":"scripts/embedding.py","size":6020,"sha256":"5c042350c800a3e578e67f31362768cd3332a093df22dbd0819fbf66da53ee7f","contentType":"text/x-python; charset=utf-8"},{"id":"d82ddeb1-c7b9-500f-9438-c262a6681677","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/d82ddeb1-c7b9-500f-9438-c262a6681677/attachment.py","path":"scripts/execute_sql.py","size":3520,"sha256":"302c07428ec85a17635f8a9843cb45fa55c51244451d71b849b23be2cee9f03f","contentType":"text/x-python; charset=utf-8"},{"id":"9c1c436d-6381-56eb-9bb5-8567535cd003","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/9c1c436d-6381-56eb-9bb5-8567535cd003/attachment.sh","path":"scripts/export_config.sh","size":540,"sha256":"5d029bca44bed7046b890f313cf2e8536573aef1d8ea91933bdd9f9d7a2a2edc","contentType":"application/x-sh; charset=utf-8"},{"id":"147b1861-6c59-5e82-81d0-885bf29254eb","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/147b1861-6c59-5e82-81d0-885bf29254eb/attachment.py","path":"scripts/list_tables.py","size":2552,"sha256":"6bae087b3d1c6a5975adc56ac68a0bca2822eadbc6d644b7d55ed4086379cea6","contentType":"text/x-python; charset=utf-8"},{"id":"bab95fe7-f5b3-57f6-b351-2a3d0ac8d83b","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/bab95fe7-f5b3-57f6-b351-2a3d0ac8d83b/attachment.py","path":"scripts/search_client.py","size":19417,"sha256":"9e644616d0706b142598c06bd97f6ad4022542d79391574221f54b2a4c333abc","contentType":"text/x-python; charset=utf-8"},{"id":"cca53dd3-3cb8-540b-8194-489789236b71","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/cca53dd3-3cb8-540b-8194-489789236b71/attachment.py","path":"scripts/text2sql.py","size":7696,"sha256":"fd81153dcf90374ecdb280b89198fbd687e22f203faafa89e3cbc39061255bf9","contentType":"text/x-python; charset=utf-8"}],"bundle_sha256":"16687230d452e042424e2790e81a3c7696d360700422be45a4bca5edc373f8c2","attachment_count":7,"text_attachments":6,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":1,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/byted-bytehouse-ai-query/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"data-analytics","category_label":"Data"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"data-analytics","import_tag":"clean-skills-v1","description":"ByteHouse AI 查询技能,支持自然语言转SQL(Text2SQL)、SQL执行、表结构查询、多模态向量化和向量检索,用于ByteHouse数据库的自然语言查询、SQL生成与执行。"}},"renderedAt":1782981588511}

byted-bytehouse-ai-query 描述 ByteHouse AI Query Skill,提供 Text2SQL 接口能力,支持将自然语言转换为 SQL 并执行查询。 核心能力 : 1. Text2SQL - 将自然语言描述的查询需求转换为 ByteHouse SQL 语句 2. List Tables - 列出数据库中的表 3. Execute SQL - 执行 SQL 查询并返回结果 4. 多模态向量化 - 支持文本、图片、视频的向量化存储和混合检索 📁 文件说明 - SKILL.md - 本文件,技能主文档 - init config.py - 初始化配置文件脚本 - text2sql.py - Text2SQL 转换脚本 - list tables.py - 列出数据库中的表 - execute sql.py - 执行 SQL 查询脚本 - embedding.py - 多模态向量化脚本 - search client.py - 向量检索客户端脚本(使用ByteHouse向量检索) - export config.sh - 配置导出环境变量脚本(从 /.bytehouse config.json读取) 把这个文档也发给客户,文档里面介绍了如何获取主机地址和密码:https://www.volcengine.com/docs/6517/1121919?la…