Update default prompt (#11984)

### What problem does this PR solve?

New default prompt:

```
You are an intelligent assistant. Your primary function is to answer questions based strictly on the provided knowledge base.

**Essential Rules:**
- Your answer must be derived **solely** from this knowledge base: `{knowledge}`.
- **When information is available**: Summarize the content to give a detailed answer.
- **When information is unavailable**: Your response must contain this exact sentence: "The answer you are looking for is not found in the knowledge base!"
- **Always consider** the entire conversation history.
```

Also fix some grammar errors.

### Type of change

- [x] Refactoring

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2025-12-17 12:57:24 +08:00
committed by GitHub
parent 205a6483f5
commit 5e05f43c3d
5 changed files with 21 additions and 14 deletions

View File

@ -50,10 +50,12 @@ class Chat(Base):
self.opener = "Hi! I'm your assistant. What can I do for you?"
self.show_quote = True
self.prompt = (
"You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. "
"Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, "
"your answer must include the sentence 'The answer you are looking for is not found in the knowledge base!' "
"Answers need to consider chat history.\nHere is the knowledge base:\n{knowledge}\nThe above is the knowledge base."
"You are an intelligent assistant. Your primary function is to answer questions based strictly on the provided knowledge base."
"**Essential Rules:**"
"- Your answer must be derived **solely** from this knowledge base: `{knowledge}`."
"- **When information is available**: Summarize the content to give a detailed answer."
"- **When information is unavailable**: Your response must contain this exact sentence: 'The answer you are looking for is not found in the knowledge base!' "
"- **Always consider** the entire conversation history."
)
super().__init__(rag, res_dict)

View File

@ -146,10 +146,12 @@ class RAGFlow:
prompt.opener = "Hi! I'm your assistant. What can I do for you?"
if prompt.prompt is None:
prompt.prompt = (
"You are an intelligent assistant. Please summarize the content of the knowledge base to answer the question. "
"Please list the data in the knowledge base and answer in detail. When all knowledge base content is irrelevant to the question, "
"your answer must include the sentence 'The answer you are looking for is not found in the knowledge base!' "
"Answers need to consider chat history.\nHere is the knowledge base:\n{knowledge}\nThe above is the knowledge base."
"You are an intelligent assistant. Your primary function is to answer questions based strictly on the provided knowledge base."
"**Essential Rules:**"
"- Your answer must be derived **solely** from this knowledge base: `{knowledge}`."
"- **When information is available**: Summarize the content to give a detailed answer."
"- **When information is unavailable**: Your response must contain this exact sentence: 'The answer you are looking for is not found in the knowledge base!' "
"- **Always consider** the entire conversation history."
)
temp_dict = {"name": name, "avatar": avatar, "dataset_ids": dataset_list if dataset_list else [], "llm": llm.to_json(), "prompt": prompt.to_json()}