将 Workers AI 与 Chat UI ↗(由 Hugging Face 提供的开源聊天界面)结合使用。
你需要以下内容:
- Cloudflare 账户 ↗
- 你的 Account ID
- 用于 Workers AI 的 API token
首先,决定如何引用 Account ID 和 API token(直接在 .env.local 中使用 CLOUDFLARE_ACCOUNT_ID 和 CLOUDFLARE_API_TOKEN 变量,或在端点配置中指定)。
然后,按照 Chat UI GitHub 仓库 ↗ 中的其余设置说明操作。
设置模型时,指定 cloudflare 端点。
{
"name" : "nousresearch/hermes-2-pro-mistral-7b",
"tokenizer": "nousresearch/hermes-2-pro-mistral-7b",
"parameters": {
"stop": ["<|im_end|>"]
},
"endpoints" : [
{
"type": "cloudflare",
// optionally specify these if not included in .env.local
"accountId": "your-account-id",
"apiToken": "your-api-token"
//
}
]
}此模板适用于任何以 @hf 参数开头的文本生成模型。