From 11fa70f7d1f998289af1f14794effa2c2c01133d Mon Sep 17 00:00:00 2001 From: yangdx Date: Fri, 9 May 2025 10:43:19 +0800 Subject: [PATCH] Update README.md --- README-zh.md | 16 ++++++++-------- README.md | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README-zh.md b/README-zh.md index 9f16dd7c..b593b634 100644 --- a/README-zh.md +++ b/README-zh.md @@ -532,20 +532,20 @@ response = rag.query( ) ``` -### 自定义用户提示词 +### 用户提示词 vs. 查询内容 -自定义用户提示词不影响查询内容,仅仅用于向LLM指示如何处理查询结果。以下是使用方法: +当使用LightRAG查询内容的时候,不要把内容查询和与查询结果无关的输出加工写在一起。因为把两者混在一起会严重影响查询的效果。Query Param中的`user_prompt`就是为解决这一问题而设计的。`user_prompt`中的内容不参与RAG中的查询过程,它仅会在获得查询结果之后,与查询结果一起送给LLM,指导LLM如何处理查询结果。以下是使用方法: ```python -# 创建查询参数 +# Create query parameters query_param = QueryParam( - mode = "hybrid", # 或其他模式:"local"、"global"、"hybrid"、"mix"和"naive" - user_prompt = "Please create the diagram using the Mermaid syntax" + mode = "hybrid", # Other modes:local, global, hybrid, mix, naive + user_prompt = "如需画图使用mermaid格式,节点名称用英文或拼音,显示名称用中文", ) -# 查询和处理 +# Query and process response_default = rag.query( - "Please draw a character relationship diagram for Scrooge", + "请画出 Scrooge 的人物关系图谱", param=query_param ) print(response_default) @@ -755,7 +755,7 @@ rag = LightRAG( create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype)); CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties); ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx; - + -- 如有必要可以删除 drop INDEX entity_p_idx; drop INDEX vertex_p_idx; diff --git a/README.md b/README.md index e060a0b4..df3b2920 100644 --- a/README.md +++ b/README.md @@ -570,15 +570,15 @@ response = rag.query( -### 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 # Create query parameters query_param = QueryParam( - mode = "hybrid", # 或其他模式:"local"、"global"、"hybrid"、"mix"和"naive" - user_prompt = "Please create the diagram using the Mermaid syntax" + mode = "hybrid", # Other modes:local, global, hybrid, mix, naive + user_prompt = "For diagrams, use mermaid format with English/Pinyin node names and Chinese display labels", ) # Query and process @@ -759,7 +759,7 @@ For production level scenarios you will most likely want to leverage an enterpri create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype)); CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties); ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx; - + -- drop if necessary drop INDEX entity_p_idx; drop INDEX vertex_p_idx;