From d4f0ac4f6441200dc347700e44ef587335beaad0 Mon Sep 17 00:00:00 2001 From: donbr Date: Thu, 28 Nov 2024 20:08:19 -0800 Subject: [PATCH] Update README.md to move Neo4j Storage content Move `Using Neo4J for Storage` content outside of Ollama details group for improved visibility to this option. --- README.md | 55 +++++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 4181e98a..269e8249 100644 --- a/README.md +++ b/README.md @@ -203,34 +203,6 @@ rag = LightRAG( ) ``` -### Using Neo4J for Storage - -* For production level scenarios you will most likely want to leverage an enterprise solution -* for KG storage. Running Neo4J in Docker is recommended for seamless local testing. -* See: https://hub.docker.com/_/neo4j - - -```python -export NEO4J_URI="neo4j://localhost:7687" -export NEO4J_USERNAME="neo4j" -export NEO4J_PASSWORD="password" - -When you launch the project be sure to override the default KG: NetworkS -by specifying kg="Neo4JStorage". - -# Note: Default settings use NetworkX -#Initialize LightRAG with Neo4J implementation. -WORKING_DIR = "./local_neo4jWorkDir" - -rag = LightRAG( - working_dir=WORKING_DIR, - llm_model_func=gpt_4o_mini_complete, # Use gpt_4o_mini_complete LLM model - kg="Neo4JStorage", #<-----------override KG default - log_level="DEBUG" #<-----------override log_level default -) -``` -see test_neo4j.py for a working example. - ### Increasing context size In order for LightRAG to work context should be at least 32k tokens. By default Ollama models have context size of 8k. You can achieve this using one of two ways: @@ -328,6 +300,33 @@ with open("./newText.txt") as f: rag.insert(f.read()) ``` +### Using Neo4J for Storage + +* For production level scenarios you will most likely want to leverage an enterprise solution +* for KG storage. Running Neo4J in Docker is recommended for seamless local testing. +* See: https://hub.docker.com/_/neo4j + +```python +export NEO4J_URI="neo4j://localhost:7687" +export NEO4J_USERNAME="neo4j" +export NEO4J_PASSWORD="password" + +# When you launch the project be sure to override the default KG: NetworkX +# by specifying kg="Neo4JStorage". + +# Note: Default settings use NetworkX +# Initialize LightRAG with Neo4J implementation. +WORKING_DIR = "./local_neo4jWorkDir" + +rag = LightRAG( + working_dir=WORKING_DIR, + llm_model_func=gpt_4o_mini_complete, # Use gpt_4o_mini_complete LLM model + kg="Neo4JStorage", #<-----------override KG default + log_level="DEBUG" #<-----------override log_level default +) +``` +see test_neo4j.py for a working example. + ### Insert Custom KG ```python