Skip to content

Commit 2a5651b

Browse files
committed
fix:调整dify专栏位置
1 parent 372f998 commit 2a5651b

File tree

3 files changed

+115
-28
lines changed

3 files changed

+115
-28
lines changed

docs/.vuepress/config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,6 +2205,7 @@ module.exports = {
22052205
sidebarDepth: 0,
22062206
children: [
22072207
"what-is-llmops",
2208+
"configuring-models-in-dify",
22082209
"Build-App-with-Dify",
22092210
"integrate-dify-and-aws-services-to-enable-more-flexible-translation-workflows",
22102211
"llm-knowledge-base-segmentation-data-cleaning",
@@ -2337,6 +2338,28 @@ module.exports = {
23372338
]
23382339
},
23392340
],
2341+
2342+
"/md/AI/agent/dify/": [{
2343+
title: "快速上手",
2344+
collapsable: false,
2345+
sidebarDepth: 0,
2346+
children: [
2347+
"ai-agents-dont-security-nightmare",
2348+
"improve-quality-gen-ai",
2349+
]
2350+
},
2351+
{
2352+
title: "案例",
2353+
collapsable: false,
2354+
sidebarDepth: 0,
2355+
children: [
2356+
"changelog-cursor",
2357+
"goodbye-cursor-hello-windsurf",
2358+
"Junie",
2359+
"introducing-codex",
2360+
]
2361+
},
2362+
],
23402363

23412364
"/md/AI/mcp/": [{
23422365
title: "MCP",

docs/md/AI/03-core-of-rag-result-retrieval-and-reordering.md

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -116,31 +116,4 @@ Rerank:RAG中百尺竿头更进一步
116116

117117
排序模型目的在于,对召回内容有更合理排序结果,减少提供给模型的上下文长度,长度越长,对模型压力越大。
118118

119-
![](https://my-img.javaedge.com.cn/javaedge-blog/2024/06/974f3c64951c640dfd26adbf92ab2da1.png)
120-
121-
基于Learning2Rank的思路提升文本语义排序效果:
122-
123-
![](https://my-img.javaedge.com.cn/javaedge-blog/2024/06/46a36f3a3a9dc1600d21025080c63c3d.png)
124-
125-
### Listwise的优化
126-
127-
![](https://my-img.javaedge.com.cn/javaedge-blog/2024/06/d11518137f7d823c5e26a31246a45c06.png)
128-
129-
指示函数做近似:
130-
131-
![](https://my-img.javaedge.com.cn/javaedge-blog/2024/06/bc7a9bb034683c429a791e902c8b34b4.png)
132-
133-
最终loss function:
134-
135-
$$
136-
\begin{align*}
137-
\hat{\pi}(x) &= 1 + \sum_{y \in X, y \neq x} \frac{\exp(-\alpha s_{x,y})}{1 + \exp(-\alpha s_{x,y})} \\
138-
NDCG &= N_n^{-1} \sum_{x \in X} \frac{2^{r(x)} - 1}{\log_2(1 + \hat{\pi}(x))}
139-
\end{align*}
140-
$$
141-
效果对比:
142-
143-
| model | FAQ ACC@5 | 文档 ACC@5 | 混合数据 ACC@5 |
144-
| ---------------------------- | --------- | ---------- | -------------- |
145-
| bge-reranker-large(开源SOTA) | 90.26 | 75.98 | 77.17 |
146-
| Our Model | 93.76 | 83.20 | 81.21 |
119+
![](https://my-img.javaedge.com.cn/javaedge-blog/2024/06/974f3c64951c640dfd26adbf92ab2da1.png)
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# 接入大模型
2+
3+
## 0 前言
4+
5+
Dify 是基于大语言模型的 AI 应用开发平台,初次使用时你需要先在 Dify 的 **设置 -- 模型供应商** 页面内添加并配置所需要的模型:
6+
7+
![](https://my-img.javaedge.com.cn/javaedge-blog/2025/02/c95919356dc219d46368fa949caebb6b.png)
8+
9+
10+
11+
![](https://my-img.javaedge.com.cn/javaedge-blog/2025/02/9186c0fc944a39fb95f969b8e1975c9c.png)
12+
13+
Dify支持主流模型供应商,如OpenAI GPT系、Anthropic Claude系。不同模型能力表现、参数类型不一,据不同情景应用需求选择喜欢的模型供应商。在 Dify 应用模型能力前,应前往不同的模型厂商官方网站获得他们的 API key 。
14+
15+
## 1 模型类型
16+
17+
Dify按模型使用场景将模型分类:
18+
19+
### 1.1 系统推理
20+
21+
在创建的应用中,用的是该类型的模型。智聊、对话名称生成、下一步问题建议用的也是推理模型。
22+
23+
> 已支持系统推理模型的供应商:[OpenAI](https://platform.openai.com/account/api-keys)[Azure OpenAI Service](https://azure.microsoft.com/en-us/products/ai-services/openai-service/)[Anthropic](https://console.anthropic.com/account/keys)、Hugging Face Hub、Replicate、Xinference、OpenLLM、[讯飞星火](https://www.xfyun.cn/solutions/xinghuoAPI)[文心一言](https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application)[通义千问](https://dashscope.console.aliyun.com/api-key\_management?spm=a2c4g.11186623.0.0.3bbc424dxZms9k)[Minimax](https://api.minimax.chat/user-center/basic-information/interface-key)、ZHIPU(ChatGLM)
24+
25+
### 1.2 Embedding
26+
27+
知识库应用中:
28+
29+
- 将分段过的文档做 Embedding
30+
- 将用户的提问做 Embedding 处理
31+
32+
> 已支持的 Embedding 模型供应商:OpenAI、ZHIPU(ChatGLM)、Jina AI([Jina Embeddings](https://jina.ai/embeddings/))
33+
34+
### 1.3 Rerank
35+
36+
为增强检索能力,改善 LLM 搜索结果。
37+
38+
> 已支持的 Rerank 模型供应商:Cohere、Jina AI([Jina Reranker](https://jina.ai/reranker))
39+
40+
### 1.4 语音转文字
41+
42+
将对话型应用中,将语音转文字用的是该类型的模型。
43+
44+
> 已支持的语音转文字模型供应商:OpenAI
45+
46+
### 1.5 托管模型试用服务
47+
48+
为 Dify 云服务的用户提供了不同模型的试用额度,请在该额度耗尽前设置你自己的模型供应商,否则将会影响应用的正常使用。
49+
50+
* **OpenAI 托管模型试用:** 我们提供 200 次调用次数供你试用体验,可用于 GPT3.5-turbo、GPT3.5-turbo-16k、text-davinci-003 模型。
51+
52+
### 设置默认模型
53+
54+
Dify 在需要模型时,会根据使用场景来选择设置过的默认模型。在 `设置 > 模型供应商` 中设置默认模型。
55+
56+
![](https://my-img.javaedge.com.cn/javaedge-blog/2025/02/c679cdb6308534018494bb76ace549ae.png)
57+
58+
系统默认推理模型:设置创建应用使用的默认推理模型,以及对话名称生成、下一步问题建议等功能也会使用该默认推理模型。
59+
60+
## 2 接入模型设置
61+
62+
在 Dify 的 `设置 > 模型供应商` 中设置要接入的模型。
63+
64+
模型供应商分为两种:
65+
66+
### 2.1 自有模型
67+
68+
该类型的模型供应商提供的是自己开发的模型。如 OpenAI,Anthropic 等。
69+
70+
接入自有模型的供应商后,Dify 会自动接入该供应商下的所有模型。
71+
72+
在 Dify 中设置对应模型供应商的 API key,即可接入该模型供应商。
73+
74+
> Dify 使用了 [PKCS1\_OAEP](https://pycryptodome.readthedocs.io/en/latest/src/cipher/oaep.html) 来加密存储用户托管的 API 密钥,每个租户均使用了独立的密钥对进行加密,确保你的 API 密钥不被泄漏。
75+
76+
### 2.2 托管模型
77+
78+
该类型的模型供应商提供的是第三方模型。如 Hugging Face,Replicate 等。
79+
80+
托管类型的供应商上面有很多第三方模型。接入模型需要一个个的添加。具体接入方式如下:
81+
82+
* [Hugging Face](../../development/models-integration/hugging-face.md)
83+
* [Replicate](../../development/models-integration/replicate.md)
84+
* [Xinference](../../development/models-integration/xinference.md)
85+
* [OpenLLM](../../development/models-integration/openllm.md)
86+
87+
## 3 使用模型
88+
89+
配置完模型后,就可以在应用中使用这些模型了:
90+
91+
![](https://my-img.javaedge.com.cn/javaedge-blog/2025/02/c55e9ca6059b84da51ee9d246493d977.png)

0 commit comments

Comments
 (0)