liumaolin commited on
Commit
ece34f8
·
1 Parent(s): c545fd9

Simplify system prompts for test dialogue in Chinese and English

Browse files

- Refine prompt content for improved clarity, brevity, and conversational flow.
- Remove redundant "thinking process" elements from both language prompts.

Files changed (1) hide show
  1. tests/test_llm_dialogue.py +7 -10
tests/test_llm_dialogue.py CHANGED
@@ -5,8 +5,6 @@ from pathlib import Path
5
  from langchain.chains.conversation.memory import ConversationBufferWindowMemory
6
  from langchain_community.chat_models.llamacpp import ChatLlamaCpp
7
  from langchain_core.chat_history import InMemoryChatMessageHistory
8
- from langchain_core.messages import SystemMessage
9
- from langchain_core.prompts import ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder
10
  from langchain_core.runnables.history import RunnableWithMessageHistory
11
 
12
  HERE = Path(__file__).parent.parent
@@ -19,18 +17,17 @@ from voice_dialogue.config.llm_config import get_llm_model_params
19
  from voice_dialogue.services.text.processor import create_langchain_pipeline
20
 
21
  CHINESE_SYSTEM_PROMPT = (
22
- "你是善于模拟真实的思考过程的AI助手。"
23
- "回答时,必须首先生成一个不超过5个字的简短句子,"
24
- "比如:\"让我想一下。\"、\"在我看来。\"、\"稍等我理一理。\"、\"不错的问题。\"、\"稍等片刻。\"等,然后再进行正式回答,"
25
- "保持中文口语化表达,禁用emoji和系统相关描述,确保衔接词与内容存在合理逻辑关联。"
26
  "/no_think"
27
  )
28
 
29
  ENGLISH_SYSTEM_PROMPT = (
30
- "You are an AI assistant skilled at simulating authentic thinking processes. "
31
- "When responding, you must first generate a brief phrase of no more than 5 words, "
32
- "such as: 'Let me think.', 'I see.', 'Let me process this.', 'Good question.', 'One moment.', etc., then proceed with your formal response. "
33
- "Maintain natural conversational English expression, avoid emojis and system-related descriptions, and ensure logical coherence between transitional phrases and content."
34
  "/no_think"
35
  )
36
 
 
5
  from langchain.chains.conversation.memory import ConversationBufferWindowMemory
6
  from langchain_community.chat_models.llamacpp import ChatLlamaCpp
7
  from langchain_core.chat_history import InMemoryChatMessageHistory
 
 
8
  from langchain_core.runnables.history import RunnableWithMessageHistory
9
 
10
  HERE = Path(__file__).parent.parent
 
17
  from voice_dialogue.services.text.processor import create_langchain_pipeline
18
 
19
  CHINESE_SYSTEM_PROMPT = (
20
+ "你是AI助手。请以自然流畅的中文口语化表达直接回答问题,避免冗余的思考过程。"
21
+ "你的回答第一句话必须少于十个字。每段回答控制在二到三句话,既不要过短也不要过长,以适应对话语境。"
22
+ "回答应准确、精炼且有依据。"
 
23
  "/no_think"
24
  )
25
 
26
  ENGLISH_SYSTEM_PROMPT = (
27
+ "You are an AI assistant. "
28
+ "Please answer directly and naturally, using conversational English, without showing your thinking process. "
29
+ "Your first sentence must be less than 10 words. "
30
+ "Your responses should be accurate, concise, and well-supported, ideally around 2-3 sentences long to ensure a good conversational flow."
31
  "/no_think"
32
  )
33