Update README.md
This commit is contained in:
14
README-zh.md
14
README-zh.md
@@ -532,20 +532,20 @@ response = rag.query(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
### 自定义用户提示词
|
### 用户提示词 vs. 查询内容
|
||||||
|
|
||||||
自定义用户提示词不影响查询内容,仅仅用于向LLM指示如何处理查询结果。以下是使用方法:
|
当使用LightRAG查询内容的时候,不要把内容查询和与查询结果无关的输出加工写在一起。因为把两者混在一起会严重影响查询的效果。Query Param中的`user_prompt`就是为解决这一问题而设计的。`user_prompt`中的内容不参与RAG中的查询过程,它仅会在获得查询结果之后,与查询结果一起送给LLM,指导LLM如何处理查询结果。以下是使用方法:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# 创建查询参数
|
# Create query parameters
|
||||||
query_param = QueryParam(
|
query_param = QueryParam(
|
||||||
mode = "hybrid", # 或其他模式:"local"、"global"、"hybrid"、"mix"和"naive"
|
mode = "hybrid", # Other modes:local, global, hybrid, mix, naive
|
||||||
user_prompt = "Please create the diagram using the Mermaid syntax"
|
user_prompt = "如需画图使用mermaid格式,节点名称用英文或拼音,显示名称用中文",
|
||||||
)
|
)
|
||||||
|
|
||||||
# 查询和处理
|
# Query and process
|
||||||
response_default = rag.query(
|
response_default = rag.query(
|
||||||
"Please draw a character relationship diagram for Scrooge",
|
"请画出 Scrooge 的人物关系图谱",
|
||||||
param=query_param
|
param=query_param
|
||||||
)
|
)
|
||||||
print(response_default)
|
print(response_default)
|
||||||
|
@@ -570,15 +570,15 @@ response = rag.query(
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### Custom User Prompt Support
|
### User Prompt vs. Query
|
||||||
|
|
||||||
Custom user prompts do not affect the query content; they are only used to instruct the LLM on how to handle the query results. Here's how to use it:
|
When using LightRAG for content queries, avoid combining the search process with unrelated output processing, as this significantly impacts query effectiveness. The `user_prompt` parameter in Query Param is specifically designed to address this issue — it does not participate in the RAG retrieval phase, but rather guides the LLM on how to process the retrieved results after the query is completed. Here's how to use it:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Create query parameters
|
# Create query parameters
|
||||||
query_param = QueryParam(
|
query_param = QueryParam(
|
||||||
mode = "hybrid", # 或其他模式:"local"、"global"、"hybrid"、"mix"和"naive"
|
mode = "hybrid", # Other modes:local, global, hybrid, mix, naive
|
||||||
user_prompt = "Please create the diagram using the Mermaid syntax"
|
user_prompt = "For diagrams, use mermaid format with English/Pinyin node names and Chinese display labels",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Query and process
|
# Query and process
|
||||||
|
Reference in New Issue
Block a user