Copilot commented on code in PR #13208:
URL: https://github.com/apache/apisix/pull/13208#discussion_r3076972763
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -128,25 +129,27 @@
AZ_AI_SEARCH_ENDPOINT=${AZ_AI_SEARCH_SVC_DOMAIN}/indexes/${AZ_AI_SEARCH_INDEX}/d
:::note
-您可以使用以下命令从 `config.yaml` 获取 `admin_key` 并保存到环境变量中:
+你可以使用以下命令从 `config.yaml` 获取 `admin_key` 并保存到环境变量中:
Review Comment:
这里使用了“你可以…”,与仓库内多数中文插件文档使用的“您可以…”不一致。建议统一为“您可以…”。
```suggestion
您可以使用以下命令从 `config.yaml` 获取 `admin_key` 并保存到环境变量中:
```
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -103,16 +104,16 @@ description: ai-rag 插件通过检索增强生成(RAG)增强 LLM 输出,
## 示例
-要跟随示例,请创建一个 [Azure 账户](https://portal.azure.com)并完成以下步骤:
+要跟随示例操作,请创建一个 [Azure 账户](https://portal.azure.com)并完成以下步骤:
-* 在 [Azure AI Foundry](https://oai.azure.com/portal) 中,部署一个生成式聊天模型,如
`gpt-4o`,以及一个嵌入模型,如 `text-embedding-3-large`。获取 API 密钥和模型端点。
+* 在 [Azure AI Foundry](https://oai.azure.com/portal) 中,部署一个生成式聊天模型(如
`gpt-4o`)和一个嵌入模型(如 `text-embedding-3-large`)。获取 API 密钥和模型端点。
* 按照 [Azure
的示例](https://github.com/Azure/azure-search-vector-samples/blob/main/demo-python/code/basic-vector-workflow/azure-search-vector-python-sample.ipynb)使用
Python 在 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
中准备向量搜索。该示例将创建一个名为 `vectest` 的搜索索引,具有所需的架构,并上传包含 108 个各种 Azure
服务描述的[示例数据](https://github.com/Azure/azure-search-vector-samples/blob/main/data/text-sample.json),以便基于
`title` 和 `content` 生成嵌入 `titleVector` 和 `contentVector`。在 Python
中执行向量搜索之前完成所有设置。
* 在 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search) 中,[获取
Azure 向量搜索 API
密钥和搜索服务端点](https://learn.microsoft.com/en-us/azure/search/search-get-started-vector?tabs=api-key#retrieve-resource-information)。
将 API 密钥和端点保存到环境变量:
```shell
-# 替换为您的值
+# 替换为你的值
Review Comment:
中文文档其余部分多使用“您/您的”的正式表达,这里改成了“你的”,风格不一致。建议统一为“您的”。
```suggestion
# 替换为您的值
```
##########
docs/en/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+Synchronize the configuration to the gateway:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
Kubernetes 示例里 `api_key` 填成了 `Bearer your-api-key`。Azure OpenAI / Azure AI
Search 的 `api-key` 一般是直接填原始 key(不带 `Bearer ` 前缀),否则会导致鉴权失败。建议将示例中的 `api_key`
改为纯 key 占位符并与前面的 Admin API/ADC 示例保持一致。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/en/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+Synchronize the configuration to the gateway:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
`ai-proxy` 的 `auth.header.api-key` 示例写成了 `Bearer your-api-key`,但 Azure
OpenAI 的 `api-key` 头通常不使用 Bearer 方案,应该直接传 API key 字符串。否则读者照抄会导致请求 401/403。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/en/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+Synchronize the configuration to the gateway:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
+ model: gpt-4o
+ override:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview"
+---
+apiVersion: gateway.networking.k8s.io/v1
+kind: HTTPRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ parentRefs:
+ - name: apisix
+ rules:
+ - matches:
+ - path:
+ type: Exact
+ value: /rag
+ method: POST
+ filters:
+ - type: ExtensionRef
+ extensionRef:
+ group: apisix.apache.org
+ kind: PluginConfig
+ name: ai-rag-plugin-config
+```
+
+</TabItem>
+<TabItem value="ingress" label="APISIX Ingress Controller">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ ingressClassName: apisix
+ http:
+ - name: ai-rag-route
+ match:
+ paths:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ - name: ai-rag
+ enable: true
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ enable: true
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
APISIX Ingress Controller 示例里 `api_key` 填成了 `Bearer your-api-key`,与 Azure
OpenAI / Azure AI Search 实际使用方式不符(通常不带 `Bearer ` 前缀)。建议改为纯 key 占位符并与 Admin
API/ADC 示例对齐。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
enable: true
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+将配置同步到网关:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
Kubernetes 示例里 `api_key` 填成了 `Bearer your-api-key`。Azure OpenAI / Azure AI
Search 的 `api-key` 一般直接填原始 key(不带 `Bearer ` 前缀),否则会导致鉴权失败。建议将示例中的 `api_key` 改为纯
key 占位符并与前面的 Admin API/ADC 示例保持一致。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+将配置同步到网关:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
+ model: gpt-4o
+ override:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview"
+---
+apiVersion: gateway.networking.k8s.io/v1
+kind: HTTPRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ parentRefs:
+ - name: apisix
+ rules:
+ - matches:
+ - path:
+ type: Exact
+ value: /rag
+ method: POST
+ filters:
+ - type: ExtensionRef
+ extensionRef:
+ group: apisix.apache.org
+ kind: PluginConfig
+ name: ai-rag-plugin-config
+```
+
+</TabItem>
+<TabItem value="ingress" label="APISIX Ingress Controller">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ ingressClassName: apisix
+ http:
+ - name: ai-rag-route
+ match:
+ paths:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ - name: ai-rag
+ enable: true
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ enable: true
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
APISIX Ingress Controller 示例里 `api_key` 填成了 `Bearer your-api-key`,与 Azure
OpenAI / Azure AI Search 实际使用方式不符(通常不带 `Bearer ` 前缀)。建议改为纯 key 占位符并与 Admin
API/ADC 示例对齐。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
enable: true
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+将配置同步到网关:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
+ model: gpt-4o
+ override:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview"
+---
+apiVersion: gateway.networking.k8s.io/v1
+kind: HTTPRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ parentRefs:
+ - name: apisix
+ rules:
+ - matches:
+ - path:
+ type: Exact
+ value: /rag
+ method: POST
+ filters:
+ - type: ExtensionRef
+ extensionRef:
+ group: apisix.apache.org
+ kind: PluginConfig
+ name: ai-rag-plugin-config
+```
+
+</TabItem>
+<TabItem value="ingress" label="APISIX Ingress Controller">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ ingressClassName: apisix
+ http:
+ - name: ai-rag-route
+ match:
+ paths:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ - name: ai-rag
+ enable: true
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ enable: true
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
APISIX Ingress Controller 示例里 `auth.header.api-key` 写成了 `Bearer
your-api-key`,但 Azure OpenAI 的 `api-key` 头应直接传 API key 字符串。建议去掉 `Bearer ` 前缀。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
enable: true
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -33,59 +33,60 @@ description: ai-rag 插件通过检索增强生成(RAG)增强 LLM 输出,
<link rel="canonical" href="https://docs.api7.ai/hub/ai-rag" />
</head>
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
## 描述
`ai-rag` 插件为 LLM 提供检索增强生成(Retrieval-Augmented
Generation,RAG)功能。它促进从外部数据源高效检索相关文档或信息,这些信息用于增强 LLM 响应,从而提高生成输出的准确性和上下文相关性。
-该插件支持使用 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。
-
-**_目前仅支持 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。欢迎提交 PR 以引入对其他服务提供商的支持。_**
+该插件支持使用 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。欢迎提交 PR 以引入对其他服务提供商的支持。
-## 属性
+## 插件属性
-| 名称 | 必选项 | 类型 | 描述
|
-| ----------------------------------------------- | ------------ | -------- |
-----------------------------------------------------------------------------------------------------------------------------------------
|
-| embeddings_provider | 是 | object |
嵌入模型提供商的配置。
|
-| embeddings_provider.azure_openai | 是 | object |
[Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
作为嵌入模型提供商的配置。 |
-| embeddings_provider.azure_openai.endpoint | 是 | string |
Azure OpenAI 嵌入模型端点。
|
-| embeddings_provider.azure_openai.api_key | 是 | string |
Azure OpenAI API 密钥。
|
-| vector_search_provider | 是 | object |
向量搜索提供商的配置。
|
-| vector_search_provider.azure_ai_search | 是 | object |
Azure AI Search 的配置。
|
-| vector_search_provider.azure_ai_search.endpoint | 是 | string |
Azure AI Search 端点。
|
-| vector_search_provider.azure_ai_search.api_key | 是 | string |
Azure AI Search API 密钥。
|
+| 名称 | 必选项 | 类型 | 描述 |
+| --- | --- | --- | --- |
+| `embeddings_provider` | True | object | 嵌入模型提供商的配置。 |
+| `embeddings_provider.azure_openai` | True | object | [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
嵌入模型的配置。 |
+| `embeddings_provider.azure_openai.endpoint` | True | string | Azure OpenAI
嵌入模型端点。 |
+| `embeddings_provider.azure_openai.api_key` | True | string | Azure OpenAI
API 密钥。 |
+| `vector_search_provider` | True | object | 向量搜索提供商的配置。 |
+| `vector_search_provider.azure_ai_search` | True | object | [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search) 的配置。 |
+| `vector_search_provider.azure_ai_search.endpoint` | True | string | Azure AI
Search 端点。 |
+| `vector_search_provider.azure_ai_search.api_key` | True | string | Azure AI
Search API 密钥。 |
## 请求体格式
请求体中必须包含以下字段。
-| 字段 | 类型 | 描述
|
-| -------------------- | -------- |
-------------------------------------------------------------------------------------------------------------------------------
|
-| ai_rag | object | 请求体 RAG 规范。
|
-| ai_rag.embeddings | object | 生成嵌入所需的请求参数。内容将取决于配置的提供商的 API 规范。 |
-| ai_rag.vector_search | object | 执行向量搜索所需的请求参数。内容将取决于配置的提供商的 API 规范。 |
+| 字段 | 类型 | 描述 |
+| --- | --- | --- |
+| `ai_rag` | object | 请求体 RAG 规范。 |
+| `ai_rag.embeddings` | object | 生成嵌入所需的请求参数。内容取决于配置的提供商的 API 规范。 |
+| `ai_rag.vector_search` | object | 执行向量搜索所需的请求参数。内容取决于配置的提供商的 API 规范。 |
- `ai_rag.embeddings` 的参数
- Azure OpenAI
- | 名称 | 必选项 | 类型 | 描述
|
- | --------------- | ------------ | -------- |
--------------------------------------------------------------------------------------------------------------------------
|
- | input | 是 | string | 用于计算嵌入的输入文本,编码为字符串。
|
- | user | 否 | string | 代表您的最终用户的唯一标识符,可以帮助监控和检测滥用。
|
- | encoding_format | 否 | string | 返回嵌入的格式。可以是 `float` 或
`base64`。默认为 `float`。 |
- | dimensions | 否 | integer | 结果输出嵌入应具有的维数。仅在
text-embedding-3 及更高版本的模型中支持。 |
+ | 名称 | 必选项 | 类型 | 描述 |
+ | --- | --- | --- | --- |
+ | `input` | True | string | 用于计算嵌入的输入文本,编码为字符串。 |
+ | `user` | False | string | 代表最终用户的唯一标识符,可帮助监控和检测滥用行为。 |
+ | `encoding_format` | False | string | 返回嵌入的格式。可以是 `float` 或 `base64`。默认为
`float`。 |
+ | `dimensions` | False | integer |
输出嵌入的维数。它应与你的嵌入模型的维数匹配。例如,`text-embedding-ada-002` 的维数固定为 1536。对于
`text-embedding-3-small` 或 `text-embedding-3-large`,维数范围分别为 1 到 1536 和 3072。 |
-有关其他参数,请参阅 [Azure OpenAI
嵌入文档](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings)。
+ 有关其他参数,请参阅 [Azure OpenAI
嵌入文档](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings)。
- `ai_rag.vector_search` 的参数
- Azure AI Search
- | 字段 | 必选项 | 类型 | 描述 |
- | --------- | ------------ | -------- | ---------------------------- |
- | fields | 是 | String | 向量搜索的字段。 |
+ | 字段 | 必选项 | 类型 | 描述 |
+ | --- | --- | --- | --- |
+ | `fields` | True | string | 向量搜索的字段。 |
Review Comment:
该参数表的“必选项”列使用 True,与中文文档常用的“是/否”不一致。建议统一为“是/否”。
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+将配置同步到网关:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+创建路由,配置 `ai-rag` 和 [`ai-proxy`](./ai-proxy.md) 插件:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
`ai-proxy` 的 `auth.header.api-key` 示例写成了 `Bearer your-api-key`,但 Azure
OpenAI 的 `api-key` 头通常不使用 Bearer 方案,应该直接传 API key 字符串。否则读者照抄会导致请求失败。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -33,59 +33,60 @@ description: ai-rag 插件通过检索增强生成(RAG)增强 LLM 输出,
<link rel="canonical" href="https://docs.api7.ai/hub/ai-rag" />
</head>
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
## 描述
`ai-rag` 插件为 LLM 提供检索增强生成(Retrieval-Augmented
Generation,RAG)功能。它促进从外部数据源高效检索相关文档或信息,这些信息用于增强 LLM 响应,从而提高生成输出的准确性和上下文相关性。
-该插件支持使用 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。
-
-**_目前仅支持 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。欢迎提交 PR 以引入对其他服务提供商的支持。_**
+该插件支持使用 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。欢迎提交 PR 以引入对其他服务提供商的支持。
-## 属性
+## 插件属性
-| 名称 | 必选项 | 类型 | 描述
|
-| ----------------------------------------------- | ------------ | -------- |
-----------------------------------------------------------------------------------------------------------------------------------------
|
-| embeddings_provider | 是 | object |
嵌入模型提供商的配置。
|
-| embeddings_provider.azure_openai | 是 | object |
[Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
作为嵌入模型提供商的配置。 |
-| embeddings_provider.azure_openai.endpoint | 是 | string |
Azure OpenAI 嵌入模型端点。
|
-| embeddings_provider.azure_openai.api_key | 是 | string |
Azure OpenAI API 密钥。
|
-| vector_search_provider | 是 | object |
向量搜索提供商的配置。
|
-| vector_search_provider.azure_ai_search | 是 | object |
Azure AI Search 的配置。
|
-| vector_search_provider.azure_ai_search.endpoint | 是 | string |
Azure AI Search 端点。
|
-| vector_search_provider.azure_ai_search.api_key | 是 | string |
Azure AI Search API 密钥。
|
+| 名称 | 必选项 | 类型 | 描述 |
+| --- | --- | --- | --- |
+| `embeddings_provider` | True | object | 嵌入模型提供商的配置。 |
+| `embeddings_provider.azure_openai` | True | object | [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
嵌入模型的配置。 |
+| `embeddings_provider.azure_openai.endpoint` | True | string | Azure OpenAI
嵌入模型端点。 |
+| `embeddings_provider.azure_openai.api_key` | True | string | Azure OpenAI
API 密钥。 |
+| `vector_search_provider` | True | object | 向量搜索提供商的配置。 |
+| `vector_search_provider.azure_ai_search` | True | object | [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search) 的配置。 |
+| `vector_search_provider.azure_ai_search.endpoint` | True | string | Azure AI
Search 端点。 |
+| `vector_search_provider.azure_ai_search.api_key` | True | string | Azure AI
Search API 密钥。 |
## 请求体格式
请求体中必须包含以下字段。
-| 字段 | 类型 | 描述
|
-| -------------------- | -------- |
-------------------------------------------------------------------------------------------------------------------------------
|
-| ai_rag | object | 请求体 RAG 规范。
|
-| ai_rag.embeddings | object | 生成嵌入所需的请求参数。内容将取决于配置的提供商的 API 规范。 |
-| ai_rag.vector_search | object | 执行向量搜索所需的请求参数。内容将取决于配置的提供商的 API 规范。 |
+| 字段 | 类型 | 描述 |
+| --- | --- | --- |
+| `ai_rag` | object | 请求体 RAG 规范。 |
+| `ai_rag.embeddings` | object | 生成嵌入所需的请求参数。内容取决于配置的提供商的 API 规范。 |
+| `ai_rag.vector_search` | object | 执行向量搜索所需的请求参数。内容取决于配置的提供商的 API 规范。 |
- `ai_rag.embeddings` 的参数
- Azure OpenAI
- | 名称 | 必选项 | 类型 | 描述
|
- | --------------- | ------------ | -------- |
--------------------------------------------------------------------------------------------------------------------------
|
- | input | 是 | string | 用于计算嵌入的输入文本,编码为字符串。
|
- | user | 否 | string | 代表您的最终用户的唯一标识符,可以帮助监控和检测滥用。
|
- | encoding_format | 否 | string | 返回嵌入的格式。可以是 `float` 或
`base64`。默认为 `float`。 |
- | dimensions | 否 | integer | 结果输出嵌入应具有的维数。仅在
text-embedding-3 及更高版本的模型中支持。 |
+ | 名称 | 必选项 | 类型 | 描述 |
+ | --- | --- | --- | --- |
+ | `input` | True | string | 用于计算嵌入的输入文本,编码为字符串。 |
+ | `user` | False | string | 代表最终用户的唯一标识符,可帮助监控和检测滥用行为。 |
+ | `encoding_format` | False | string | 返回嵌入的格式。可以是 `float` 或 `base64`。默认为
`float`。 |
+ | `dimensions` | False | integer |
输出嵌入的维数。它应与你的嵌入模型的维数匹配。例如,`text-embedding-ada-002` 的维数固定为 1536。对于
`text-embedding-3-small` 或 `text-embedding-3-large`,维数范围分别为 1 到 1536 和 3072。 |
Review Comment:
该参数表的“必选项”列使用 True/False,与中文文档常用的“是/否”不一致。建议统一为“是/否”。
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -197,7 +354,7 @@ curl "http://127.0.0.1:9080/rag" -X POST \
}'
```
-您应该收到类似以下的 `HTTP/1.1 200 OK` 响应:
+你应该收到类似以下的 `HTTP/1.1 200 OK` 响应:
Review Comment:
这里使用了“你应该收到…”,与中文文档常用的“您应该收到…”不一致。建议统一为“您应该收到…”。
```suggestion
您应该收到类似以下的 `HTTP/1.1 200 OK` 响应:
```
##########
docs/en/latest/plugins/ai-rag.md:
##########
@@ -130,23 +131,25 @@
AZ_AI_SEARCH_ENDPOINT=${AZ_AI_SEARCH_SVC_DOMAIN}/indexes/${AZ_AI_SEARCH_INDEX}/d
You can fetch the `admin_key` from `config.yaml` and save to an environment
variable with the following command:
-```bash
+```shell
admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed
's/"//g')
```
:::
-### Integrate with Azure for RAG-Enhaned Responses
+### Integrate with Azure for RAG-Enhanced Responses
The following example demonstrates how you can use the
[`ai-proxy`](./ai-proxy.md) Plugin to proxy requests to Azure OpenAI LLM and
use the `ai-rag` Plugin to generate embeddings and perform vector search to
enhance LLM responses.
Review Comment:
The environment-variable snippet in this example section contains what looks
like real Azure OpenAI / Azure AI Search API keys (long random strings). Public
docs should use clear placeholders (for example `<your-api-key>`) to avoid
accidental credential exposure.
##########
docs/en/latest/plugins/ai-rag.md:
##########
@@ -179,6 +182,160 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
}'
```
+</TabItem>
+<TabItem value="adc" label="ADC">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="adc.yaml"
+services:
+ - name: ai-rag-service
+ routes:
+ - name: ai-rag-route
+ uris:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ ai-rag:
+ embeddings_provider:
+ azure_openai:
+ endpoint: "${AZ_EMBEDDINGS_ENDPOINT}"
+ api_key: "${AZ_OPENAI_API_KEY}"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint: "${AZ_AI_SEARCH_ENDPOINT}"
+ api_key: "${AZ_AI_SEARCH_KEY}"
+ ai-proxy:
+ provider: openai
+ auth:
+ header:
+ api-key: "${AZ_OPENAI_API_KEY}"
+ model: gpt-4o
+ override:
+ endpoint: "${AZ_CHAT_ENDPOINT}"
+```
+
+Synchronize the configuration to the gateway:
+
+```shell
+adc sync -f adc.yaml
+```
+
+</TabItem>
+<TabItem value="ingress" label="Ingress Controller">
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+ namespace: aic
+ name: ai-rag-plugin-config
+spec:
+ plugins:
+ - name: ai-rag
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
+ model: gpt-4o
+ override:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview"
+---
+apiVersion: gateway.networking.k8s.io/v1
+kind: HTTPRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ parentRefs:
+ - name: apisix
+ rules:
+ - matches:
+ - path:
+ type: Exact
+ value: /rag
+ method: POST
+ filters:
+ - type: ExtensionRef
+ extensionRef:
+ group: apisix.apache.org
+ kind: PluginConfig
+ name: ai-rag-plugin-config
+```
+
+</TabItem>
+<TabItem value="ingress" label="APISIX Ingress Controller">
+
+Create a Route with the `ai-rag` and [`ai-proxy`](./ai-proxy.md) Plugins
configured as such:
+
+```yaml title="ai-rag-ic.yaml"
+apiVersion: apisix.apache.org/v2
+kind: ApisixRoute
+metadata:
+ namespace: aic
+ name: ai-rag-route
+spec:
+ ingressClassName: apisix
+ http:
+ - name: ai-rag-route
+ match:
+ paths:
+ - /rag
+ methods:
+ - POST
+ plugins:
+ - name: ai-rag
+ enable: true
+ config:
+ embeddings_provider:
+ azure_openai:
+ endpoint:
"https://your-openai-resource.openai.azure.com/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15"
+ api_key: "Bearer your-api-key"
+ vector_search_provider:
+ azure_ai_search:
+ endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
+ api_key: "Bearer your-api-key"
+ - name: ai-proxy
+ enable: true
+ config:
+ provider: openai
+ auth:
+ header:
+ api-key: "Bearer your-api-key"
Review Comment:
APISIX Ingress Controller 示例里 `auth.header.api-key` 写成了 `Bearer
your-api-key`,但 Azure OpenAI 的 `api-key` 头应直接传 API key 字符串。建议去掉 `Bearer ` 前缀。
```suggestion
api_key: "your-api-key"
vector_search_provider:
azure_ai_search:
endpoint:
"https://your-search-service.search.windows.net/indexes/vectest/docs/search?api-version=2024-07-01"
api_key: "your-api-key"
- name: ai-proxy
enable: true
config:
provider: openai
auth:
header:
api-key: "your-api-key"
```
##########
docs/zh/latest/plugins/ai-rag.md:
##########
@@ -33,59 +33,60 @@ description: ai-rag 插件通过检索增强生成(RAG)增强 LLM 输出,
<link rel="canonical" href="https://docs.api7.ai/hub/ai-rag" />
</head>
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
## 描述
`ai-rag` 插件为 LLM 提供检索增强生成(Retrieval-Augmented
Generation,RAG)功能。它促进从外部数据源高效检索相关文档或信息,这些信息用于增强 LLM 响应,从而提高生成输出的准确性和上下文相关性。
-该插件支持使用 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。
-
-**_目前仅支持 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。欢迎提交 PR 以引入对其他服务提供商的支持。_**
+该插件支持使用 [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
和 [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search)
服务来生成嵌入和执行向量搜索。欢迎提交 PR 以引入对其他服务提供商的支持。
-## 属性
+## 插件属性
-| 名称 | 必选项 | 类型 | 描述
|
-| ----------------------------------------------- | ------------ | -------- |
-----------------------------------------------------------------------------------------------------------------------------------------
|
-| embeddings_provider | 是 | object |
嵌入模型提供商的配置。
|
-| embeddings_provider.azure_openai | 是 | object |
[Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
作为嵌入模型提供商的配置。 |
-| embeddings_provider.azure_openai.endpoint | 是 | string |
Azure OpenAI 嵌入模型端点。
|
-| embeddings_provider.azure_openai.api_key | 是 | string |
Azure OpenAI API 密钥。
|
-| vector_search_provider | 是 | object |
向量搜索提供商的配置。
|
-| vector_search_provider.azure_ai_search | 是 | object |
Azure AI Search 的配置。
|
-| vector_search_provider.azure_ai_search.endpoint | 是 | string |
Azure AI Search 端点。
|
-| vector_search_provider.azure_ai_search.api_key | 是 | string |
Azure AI Search API 密钥。
|
+| 名称 | 必选项 | 类型 | 描述 |
+| --- | --- | --- | --- |
+| `embeddings_provider` | True | object | 嵌入模型提供商的配置。 |
+| `embeddings_provider.azure_openai` | True | object | [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
嵌入模型的配置。 |
+| `embeddings_provider.azure_openai.endpoint` | True | string | Azure OpenAI
嵌入模型端点。 |
+| `embeddings_provider.azure_openai.api_key` | True | string | Azure OpenAI
API 密钥。 |
+| `vector_search_provider` | True | object | 向量搜索提供商的配置。 |
+| `vector_search_provider.azure_ai_search` | True | object | [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search) 的配置。 |
+| `vector_search_provider.azure_ai_search.endpoint` | True | string | Azure AI
Search 端点。 |
+| `vector_search_provider.azure_ai_search.api_key` | True | string | Azure AI
Search API 密钥。 |
Review Comment:
“必选项”列在中文文档里通常使用“是/否”,这里使用了
True/False(英文布尔值),与仓库内其他中文插件文档不一致,也会让读者误以为必须填写布尔值而不是“是否必填”的含义。建议统一改为“是/否”。
```suggestion
| `embeddings_provider` | 是 | object | 嵌入模型提供商的配置。 |
| `embeddings_provider.azure_openai` | 是 | object | [Azure
OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service)
嵌入模型的配置。 |
| `embeddings_provider.azure_openai.endpoint` | 是 | string | Azure OpenAI
嵌入模型端点。 |
| `embeddings_provider.azure_openai.api_key` | 是 | string | Azure OpenAI API
密钥。 |
| `vector_search_provider` | 是 | object | 向量搜索提供商的配置。 |
| `vector_search_provider.azure_ai_search` | 是 | object | [Azure AI
Search](https://azure.microsoft.com/en-us/products/ai-services/ai-search) 的配置。 |
| `vector_search_provider.azure_ai_search.endpoint` | 是 | string | Azure AI
Search 端点。 |
| `vector_search_provider.azure_ai_search.api_key` | 是 | string | Azure AI
Search API 密钥。 |
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]