Skip to content

Commit 76e9cf1

Browse files
authored
add ai plugins (higress-group#311)
1 parent 4708ae7 commit 76e9cf1

File tree

8 files changed

+220
-0
lines changed

8 files changed

+220
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: 1.0.0
2+
info:
3+
category: custom
4+
name: ai-prompt-decorator
5+
title: AI提示词修饰器
6+
x-title-i18n:
7+
zh-CN: AI提示词修饰器
8+
description: 对LLM提示词进行修改
9+
x-description-i18n:
10+
zh-CN: 对LLM提示词进行修改
11+
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
12+
version: 1.0.0
13+
contact:
14+
name: rinfx
15+
spec:
16+
phase: UNSPECIFIED_PHASE
17+
priority: 450
18+
configSchema:
19+
openAPIV3Schema:
20+
type: object
21+
example:
22+
decorators:
23+
- name: hangzhou-guide
24+
decorator:
25+
prepend:
26+
- role: system
27+
content: "你将使用英语回答问题"
28+
- role: user
29+
content: "假设你现在所在地点为杭州"
30+
append:
31+
- role: user
32+
content: "在介绍杭州时,避开杭州的饮食"
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: 1.0.0
2+
info:
3+
category: custom
4+
name: ai-prompt-template
5+
title: AI提示词模板
6+
x-title-i18n:
7+
zh-CN: AI提示词模板
8+
description: 基于模板构建LLM提示词
9+
x-description-i18n:
10+
zh-CN: 基于模板构建LLM提示词
11+
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
12+
version: 1.0.0
13+
contact:
14+
name: rinfx
15+
spec:
16+
phase: UNSPECIFIED_PHASE
17+
priority: 500
18+
configSchema:
19+
openAPIV3Schema:
20+
type: object
21+
example:
22+
templates:
23+
- name: developer-chat
24+
template:
25+
model: gpt-3.5-turbo
26+
messages:
27+
- role: system
28+
content: '你是一个 {{program}} 专家,编程语言为 {{language}}'
29+
- role: user
30+
content: '帮我写一个 {{program}} 程序'
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: 1.0.0
2+
info:
3+
category: custom
4+
name: ai-rag
5+
title: AI检索增强生成
6+
x-title-i18n:
7+
zh-CN: AI检索增强生成
8+
description: 通过RAG技术优化大模型生成内容
9+
x-description-i18n:
10+
zh-CN: 通过RAG技术优化大模型生成内容
11+
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
12+
version: 1.0.0
13+
contact:
14+
name: rinfx
15+
spec:
16+
phase: UNSPECIFIED_PHASE
17+
priority: 400
18+
configSchema:
19+
openAPIV3Schema:
20+
type: object
21+
example:
22+
dashscope:
23+
apiKey: xxxxxxxxxxxxxxxxxxxx
24+
serviceName: dashscope
25+
servicePort: 443
26+
domain: dashscope.aliyuncs.com
27+
dashvector:
28+
apiKey: xxxxxxxxxxxxxxxxxxxx
29+
serviceName: dashvector
30+
servicePort: 443
31+
domain: vrs-cn-xxxxxxxxxxxxxxxxxxxx.dashvector.cn-hangzhou.aliyuncs.com
32+
collection: news_embedings
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: 1.0.0
2+
info:
3+
category: custom
4+
name: ai-security-guard
5+
title: AI内容安全
6+
x-title-i18n:
7+
zh-CN: AI内容安全
8+
description: 基于阿里云内容安全对大模型的输入输出进行安全检测
9+
x-description-i18n:
10+
zh-CN: 基于阿里云内容安全对大模型的输入输出进行安全检测
11+
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
12+
version: 1.0.0
13+
contact:
14+
name: rinfx
15+
spec:
16+
phase: UNSPECIFIED_PHASE
17+
priority: 300
18+
configSchema:
19+
openAPIV3Schema:
20+
type: object
21+
example:
22+
serviceSource: dns
23+
serviceName: safecheck
24+
servicePort: 443
25+
domain: green-cip.cn-shanghai.aliyuncs.com
26+
ak: xxxxxxxxxxxxxxxxxxxx
27+
sk: xxxxxxxxxxxxxxxxxxxx
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: 1.0.0
2+
info:
3+
category: custom
4+
name: ai-statistics
5+
title: AI可观测
6+
x-title-i18n:
7+
zh-CN: AI可观测
8+
description: 生成AI可观测数据
9+
x-description-i18n:
10+
zh-CN: 生成AI可观测数据
11+
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
12+
version: 1.0.0
13+
contact:
14+
name: rinfx
15+
spec:
16+
phase: UNSPECIFIED_PHASE
17+
priority: 200
18+
configSchema:
19+
openAPIV3Schema:
20+
type: object
21+
example:
22+
enable: true
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: 1.0.0
2+
info:
3+
category: custom
4+
name: ai-token-ratelimit
5+
title: AI Token 限流
6+
x-title-i18n:
7+
zh-CN: AI Token 限流
8+
description: 对大模型服务进行 Token 限流
9+
x-description-i18n:
10+
zh-CN: 对大模型服务进行 Token 限流
11+
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
12+
version: 1.0.0
13+
contact:
14+
name: rinfx
15+
spec:
16+
phase: UNSPECIFIED_PHASE
17+
priority: 600
18+
configSchema:
19+
openAPIV3Schema:
20+
type: object
21+
example:
22+
rule_name: default_rule
23+
rule_items:
24+
- limit_by_per_ip: from-remote-addr
25+
limit_keys:
26+
- key: 0.0.0.0/0
27+
token_per_minute: 100
28+
redis:
29+
service_name: redis.static
30+
service_port: 6379
31+
username: default
32+
password: '123456'
33+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: 1.0.0
2+
info:
3+
category: custom
4+
name: ai-transformer
5+
title: AI请求/响应转换
6+
x-title-i18n:
7+
zh-CN: AI请求/响应转换
8+
description: 基于LLM对请求/响应进行智能转换
9+
x-description-i18n:
10+
zh-CN: 基于LLM对请求/响应进行智能转换
11+
iconUrl: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
12+
version: 1.0.0
13+
contact:
14+
name: rinfx
15+
spec:
16+
phase: UNSPECIFIED_PHASE
17+
priority: 550
18+
configSchema:
19+
openAPIV3Schema:
20+
type: object
21+
example:
22+
request:
23+
enable: false
24+
prompt: "如果请求path是以/httpbin开头的,帮我去掉/httpbin前缀,其他的不要改。"
25+
response:
26+
enable: true
27+
prompt: "帮我修改以下HTTP应答信息,要求:1. content-type修改为application/json;2. body由xml转化为json;3.移除content-length。"
28+
provider:
29+
serviceName: qwen
30+
domain: dashscope.aliyuncs.com
31+
sk: sk-xxxxxxxxxxxxxxxxxxx
32+

backend/sdk/src/main/resources/plugins/plugins.properties

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
# specific language governing permissions and limitations under the License.
1212
#
1313

14+
ai-prompt-decorator=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-prompt-decorator:1.0.0
15+
ai-prompt-template=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-prompt-template:1.0.0
16+
ai-rag=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-rag:1.0.0
17+
ai-security-guard=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-security-guard:1.0.0
18+
ai-statistics=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-statistics:1.0.0
19+
ai-token-ratelimit=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-token-ratelimit:1.0.0
20+
ai-transformer=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-transformer:1.0.0
1421
ai-cache=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-cache:1.0.0
1522
ai-proxy=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-proxy:1.0.0
1623
basic-auth=oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/basic-auth:1.0.0

0 commit comments

Comments
 (0)