Optimizing query prompt

This commit is contained in:
yangdx
2025-05-08 12:53:28 +08:00
parent 2bafc87a80
commit b92f9b9453
2 changed files with 7 additions and 7 deletions

View File

@@ -1302,19 +1302,19 @@ async def _build_query_context(
relations_str = json.dumps(relations_context, ensure_ascii=False)
text_units_str = json.dumps(text_units_context, ensure_ascii=False)
result = f"""-----Entities-----
result = f"""-----Entities(KG)-----
```json
{entities_str}
```
-----Relationships-----
-----Relationships(KG)-----
```json
{relations_str}
```
-----Sources-----
-----Document Chunks(DC)-----
```json
{text_units_str}

View File

@@ -199,7 +199,7 @@ PROMPTS["fail_response"] = (
PROMPTS["rag_response"] = """---Role---
You are a helpful assistant responding to user query about Knowledge Base provided below.
You are a helpful assistant responding to user query about Knowledge Graph and Document Chunks provided in JSON format below.
---Goal---
@@ -215,7 +215,7 @@ When handling relationships with timestamps:
---Conversation History---
{history}
---Knowledge Base---
---Knowledge Graph and Document Chunks---
{context_data}
---Response Rules---
@@ -224,7 +224,7 @@ When handling relationships with timestamps:
- Use markdown formatting with appropriate section headings
- Please respond in the same language as the user's question.
- Ensure the response maintains continuity with the conversation history.
- List up to 5 most important reference sources at the end under "References" section. Clearly indicating whether each source is from Knowledge Graph (KG) or Vector Data (DC), and include the file path if available, in the following format: [KG/DC] file_path
- List up to 5 most important reference sources at the end under "References" section. Clearly indicating whether each source is from Knowledge Graph (KG) or Document Chunks (DC), and include the file path if available, in the following format: [KG/DC] file_path
- If you don't know the answer, just say so.
- Do not make anything up. Do not include information not provided by the Knowledge Base.
- Addtional user prompt: {user_prompt}
@@ -300,7 +300,7 @@ Output:
PROMPTS["naive_rag_response"] = """---Role---
You are a helpful assistant responding to user query about Document Chunks provided below.
You are a helpful assistant responding to user query about Document Chunks provided provided in JSON format below.
---Goal---