Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .translation-init

This file was deleted.

110 changes: 55 additions & 55 deletions docs/cn/guides/00-products/01-dee/10-enterprise-features.md

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions docs/cn/guides/51-ai-functions/01-external-functions.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
---
title: 使用外部函数自定义 AI/ML
title: 使用外部函数(External Functions)实现自定义 AI/ML
---

# 使用外部函数自定义 AI/ML
# 使用外部函数(External Functions)实现自定义 AI/ML

通过将 Databend 与您自己的基础设施连接,构建强大的 AI/ML 能力。外部函数(External Function)让您能够部署自定义模型、利用 GPU 加速,并与任何 ML 框架集成,同时确保数据安全。
通过将 Databend 与您自己的基础设施连接,构建强大的 AI/ML 能力。外部函数(External Functions)允许您部署自定义模型、利用 GPU 加速,并与任何 ML 框架集成,同时确保数据安全。

## 核心能力

| 功能 | 优势 |
| 特性 | 优势 |
|---------|----------|
| **自定义模型** | 使用任何开源或专有的 AI/ML 模型 |
| **GPU 加速** | 部署在配备 GPU 的机器上以加快推理速度 |
| **数据隐私** | 将数据保留在您的基础设施内 |
| **可扩展性** | 独立扩展和资源优化 |
| **灵活性** | 支持任何编程语言和 ML 框架 |
| **自定义模型** | 使用任何开源或专有 AI/ML 模型 |
| **GPU 加速** | 部署在配备 GPU 的机器上,实现更快推理 |
| **数据隐私** | 数据始终保留在您的基础设施内 |
| **可扩展性** | 独立扩展与资源优化 |
| **灵活性** | 支持任意编程语言与 ML 框架 |

## 工作原理

1. **创建 AI 服务器**:使用 Python 和 [databend-udf](https://pypi.org/project/databend-udf) 构建您的 AI/ML 服务器
2. **注册函数**:使用 `CREATE FUNCTION` 将您的服务器连接到 Databend
3. **在 SQL 中使用**:直接在 SQL 查询中调用您的自定义 AI 函数
1. **创建 AI 服务器**:使用 Python 和 [databend-udf](https://pypi.org/project/databend-udf) 构建 AI/ML 服务器
2. **注册函数**:通过 `CREATE FUNCTION` 将服务器接入 Databend
3. **在 SQL 中使用**:直接在 SQL 查询中调用自定义 AI 函数

## 示例:文本嵌入函数

Expand All @@ -39,17 +39,17 @@ model = SentenceTransformer('all-mpnet-base-v2') # 768 维向量
def ai_embed_768(inputs: list[str], headers) -> list[list[float]]:
"""为输入文本生成 768 维嵌入"""
try:
# 单批次处理输入
# 在单个批次中处理输入
embeddings = model.encode(inputs)
# 转换为列表格式
return [embedding.tolist() for embedding in embeddings]
except Exception as e:
print(f"Error generating embeddings: {e}")
# 如果出错,则返回空列表
# 发生错误时返回空列表
return [[] for _ in inputs]

if __name__ == '__main__':
print("正在端口 8815 上启动嵌入 UDF 服务器...")
print("Starting embedding UDF server on port 8815...")
server = UDFServer("0.0.0.0:8815")
server.add_function(ai_embed_768)
server.serve()
Expand Down Expand Up @@ -78,5 +78,5 @@ LIMIT 5;

## 了解更多

- **[外部函数指南](/guides/ai-functions/external-functions)** - 完整的设置和部署说明
- **[Databend Cloud](https://databend.cn)** - 使用免费账户试用外部函数
- **[外部函数指南](/guides/ai-functions/external-functions)** - 完整的设置与部署说明
- **[Databend Cloud](https://databend.cn)** - 免费账户体验外部函数
4 changes: 0 additions & 4 deletions docs/cn/guides/54-query/00-basics/_category_.json

This file was deleted.

90 changes: 0 additions & 90 deletions docs/cn/guides/54-query/00-basics/aggregating-data.md

This file was deleted.

103 changes: 0 additions & 103 deletions docs/cn/guides/54-query/00-basics/filtering-selection.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/cn/guides/54-query/00-basics/groupby/_category_.json

This file was deleted.

77 changes: 0 additions & 77 deletions docs/cn/guides/54-query/00-basics/groupby/group-by-cube.md

This file was deleted.

Loading