yangdx commited on
Commit
7dfcd6d
·
1 Parent(s): 79f312f

Update README

Browse files
Files changed (2) hide show
  1. README-zh.md +6 -2
  2. README.md +5 -1
README-zh.md CHANGED
@@ -74,7 +74,7 @@ pip install lightrag-hku
74
 
75
  **有关LightRAG服务器的更多信息,请参阅[LightRAG服务器](./lightrag/api/README.md)。**
76
 
77
- ## 使用LightRAG Core
78
 
79
  LightRAG核心功能的示例代码请参见`examples`目录。您还可参照[视频](https://www.youtube.com/watch?v=g21royNJ4fw)视频完成环境配置。若已持有OpenAI API密钥,可以通过以下命令运行演示代码:
80
 
@@ -89,6 +89,10 @@ curl https://raw.githubusercontent.com/gusye1234/nano-graphrag/main/tests/mock_d
89
  python examples/lightrag_openai_demo.py
90
  ```
91
 
 
 
 
 
92
  ## 查询
93
 
94
  使用以下Python代码片段(在脚本中)初始化LightRAG并执行查询:
@@ -817,7 +821,7 @@ rag = LightRAG(
817
  create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
818
  CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties);
819
  ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx;
820
-
821
  -- 如有必要可以删除
822
  drop INDEX entity_p_idx;
823
  drop INDEX vertex_p_idx;
 
74
 
75
  **有关LightRAG服务器的更多信息,请参阅[LightRAG服务器](./lightrag/api/README.md)。**
76
 
77
+ ### 使用LightRAG Core
78
 
79
  LightRAG核心功能的示例代码请参见`examples`目录。您还可参照[视频](https://www.youtube.com/watch?v=g21royNJ4fw)视频完成环境配置。若已持有OpenAI API密钥,可以通过以下命令运行演示代码:
80
 
 
89
  python examples/lightrag_openai_demo.py
90
  ```
91
 
92
+ 如需流式响应示例的实现代码,请参阅 `examples/lightrag_openai_compatible_demo.py`。运行前,请确保根据需求修改示例代码中的LLM及嵌入模型配置。
93
+
94
+ **注意事项**:在运行demo程序的时候需要注意,不同的测试程序可能使用的是不同的embedding模型,更换不同的embeding模型的时候需要把清空数据目录(`./dickens`),否则层序执行会出错。如果你想保留LLM缓存,可以在清除数据目录是保留`kv_store_llm_response_cache.json`文件。
95
+
96
  ## 查询
97
 
98
  使用以下Python代码片段(在脚本中)初始化LightRAG并执行查询:
 
821
  create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
822
  CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties);
823
  ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx;
824
+
825
  -- 如有必要可以删除
826
  drop INDEX entity_p_idx;
827
  drop INDEX vertex_p_idx;
README.md CHANGED
@@ -125,6 +125,10 @@ curl https://raw.githubusercontent.com/gusye1234/nano-graphrag/main/tests/mock_d
125
  python examples/lightrag_openai_demo.py
126
  ```
127
 
 
 
 
 
128
  ## Query
129
 
130
  Use the below Python snippet (in a script) to initialize LightRAG and perform queries:
@@ -838,7 +842,7 @@ For production level scenarios you will most likely want to leverage an enterpri
838
  create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
839
  CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties);
840
  ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx;
841
-
842
  -- drop if necessary
843
  drop INDEX entity_p_idx;
844
  drop INDEX vertex_p_idx;
 
125
  python examples/lightrag_openai_demo.py
126
  ```
127
 
128
+ For a streaming response implementation example, please see `examples/lightrag_openai_compatible_demo.py`. Prior to execution, ensure you modify the sample code’s LLM and embedding configurations accordingly.
129
+
130
+ **Note**: When running the demo program, please be aware that different test scripts may use different embedding models. If you switch to a different embedding model, you must clear the data directory (`./dickens`); otherwise, the program may encounter errors. If you wish to retain the LLM cache, you can preserve the `kv_store_llm_response_cache.json` file while clearing the data directory.
131
+
132
  ## Query
133
 
134
  Use the below Python snippet (in a script) to initialize LightRAG and perform queries:
 
842
  create INDEX CONCURRENTLY entity_idx_node_id ON dickens."Entity" (ag_catalog.agtype_access_operator(properties, '"node_id"'::agtype));
843
  CREATE INDEX CONCURRENTLY entity_node_id_gin_idx ON dickens."Entity" using gin(properties);
844
  ALTER TABLE dickens."DIRECTED" CLUSTER ON directed_sid_idx;
845
+
846
  -- drop if necessary
847
  drop INDEX entity_p_idx;
848
  drop INDEX vertex_p_idx;