kubeagi / arcadia

A diverse, simple, and secure one-stop LLMOps platform
http://www.kubeagi.com/
Apache License 2.0
63 stars 20 forks source link

Support system message in prompt #973

Open nkwangleiGIT opened 3 months ago

nkwangleiGIT commented 3 months ago

System message:

It means the system developer who can internally give some instructions for the conversation. developer can provide option for user input also which depends on the system requirements.

example

    {
      "model": "mode-id",
      "messages": [
       {
          "role": "user",
          "content": "tell me a joke"
       },
       {
          "role": "system",
          "content": "You are an assistant that speaks like Shakespeare."
       }
      ]
     }
Abirdcfly commented 3 months ago

We did not expose this option on the Web UI(because our zhipu sdk not support, but use fastchat is ok), but we support it at the CRD level spec.systemMessage, and we can manually update CR now.

# kubectl get -o yaml prompts.prompt.arcadia.kubeagi.k8s.com.cn -n kubeagi-system system
apiVersion: prompt.arcadia.kubeagi.k8s.com.cn/v1alpha1
kind: Prompt
metadata:
  annotations:
    arcadia.kubeagi.k8s.com.cn/input-rules: '[{"kind":"Input","length":1}]'
    arcadia.kubeagi.k8s.com.cn/output-rules: '[{"length":1}]'
  creationTimestamp: "2024-04-02T09:11:50Z"
  finalizers:
  - arcadia.kubeagi.k8s.com.cn/finalizer
  generation: 4
  name: system
  namespace: kubeagi-system
  resourceVersion: "60663672"
  uid: 74b92585-e9f1-46ec-9d91-b036d89f78da
spec:
  description: prompt
  displayName: prompt
  systemMessage: 将我的话翻译为英语
  userMessage: '{{.question}}'
status:
  conditions:
  - lastSuccessfulTime: "2024-04-02T09:17:11Z"
    lastTransitionTime: "2024-04-02T09:17:11Z"
    message: Success
    reason: ""
    status: "True"
    type: Ready
  observedGeneration: 4

result show: CleanShot 2024-04-02 at 17 20 24

bjwswang commented 3 months ago

@Abirdcfly @nkwangleiGIT We can also expose this option to users. @liutianyi0801 FYI

liutianyi0801 commented 2 months ago

按照我的理解,我们的角色设定就是系统 prompt image

用户会基于此,在对话的时候,进行自己的提示词编辑,如: 在对话的过程中,输入:

请阅读我上传的文档,并生成一个详细摘要。 目标是通过摘要提供一个全面的文档大意,使读者即使没有阅读整个文档,也能理解其核心内容和重要性。字数不限制,但请确保摘要准确、全面且易于理解。 image