文档

AI 提示词装饰器

更新时间:

本文介绍AI 提示词装饰器。

简介

AI提示词装饰器插件,支持在LLM的请求前后插入prompt。

配置说明

名称

数据类型

填写要求

默认值

描述

decorators

Array of decorator

必填

-

装饰器设置

decorator 配置说明:

名称

数据类型

填写要求

默认值

描述

name

string

必填

-

修饰名称

decorator.prepend

array of message object

必填

-

在初始输入之前插入的语句

decorator.append

array of message object

必填

-

在初始输入之后插入的语句

message object 配置说明:

名称

数据类型

填写要求

默认值

描述

role

string

必填

-

角色

content

string

必填

-

消息

示例

配置示例如下:

decorators:
- name: "qa-agent"
  decorator:
    prepend:
    - role: system
      content: "请使用英语回答问题."
    append:
    - role: user
      content: "每次回答完问题,尝试进行反问"

使用以上配置发起请求:

curl http://localhost/v1/chat/completions \
-H "decorator: qa-agent" \
-H "content-type: application/json" \
-d '{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "user",
      "content": "你是谁?你能帮我做什么?."
    }
  ]
}