LarFii commited on
Commit
6d5e41a
Β·
1 Parent(s): 251e443

update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -5
README.md CHANGED
@@ -7,7 +7,6 @@
7
  <p>
8
  <a href='https://lightrag.github.io'><img src='https://img.shields.io/badge/Project-Page-Green'></a>
9
  <a href='https://arxiv.org/abs/2410.05779'><img src='https://img.shields.io/badge/arXiv-2410.05779-b31b1b'></a>
10
- <img src="https://badges.pufler.dev/visits/hkuds/lightrag?style=flat-square&logo=github">
11
  <img src='https://img.shields.io/github/stars/hkuds/lightrag?color=green&style=social' />
12
  </p>
13
  <p>
@@ -21,6 +20,7 @@ This repository hosts the code of LightRAG. The structure of this code is based
21
  </div>
22
 
23
  ## πŸŽ‰ News
 
24
  - [x] [2024.10.15]πŸŽ―πŸŽ―πŸ“’πŸ“’LightRAG now supports Hugging Face models!
25
 
26
  ## Install
@@ -37,7 +37,7 @@ pip install lightrag-hku
37
  ```
38
 
39
  ## Quick Start
40
-
41
  * Set OpenAI API key in environment if using OpenAI models: `export OPENAI_API_KEY="sk-...".`
42
  * Download the demo text "A Christmas Carol by Charles Dickens":
43
  ```bash
@@ -84,7 +84,7 @@ from transformers import AutoModel, AutoTokenizer
84
  # Initialize LightRAG with Hugging Face model
85
  rag = LightRAG(
86
  working_dir=WORKING_DIR,
87
- llm_model_func=hf_model_complete, # Use Hugging Face complete model for text generation
88
  llm_model_name='meta-llama/Llama-3.1-8B-Instruct', # Model name from Hugging Face
89
  # Use Hugging Face embedding function
90
  embedding_func=EmbeddingFunc(
@@ -98,6 +98,27 @@ rag = LightRAG(
98
  ),
99
  )
100
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  ### Batch Insert
102
  ```python
103
  # Batch Insert: Insert multiple texts at once
@@ -326,8 +347,10 @@ def extract_queries(file_path):
326
  β”œβ”€β”€ examples
327
  β”‚ β”œβ”€β”€ batch_eval.py
328
  β”‚ β”œβ”€β”€ generate_query.py
329
- β”‚ β”œβ”€β”€ lightrag_openai_demo.py
330
- β”‚ └── lightrag_hf_demo.py
 
 
331
  β”œβ”€β”€ lightrag
332
  β”‚ β”œβ”€β”€ __init__.py
333
  β”‚ β”œβ”€β”€ base.py
 
7
  <p>
8
  <a href='https://lightrag.github.io'><img src='https://img.shields.io/badge/Project-Page-Green'></a>
9
  <a href='https://arxiv.org/abs/2410.05779'><img src='https://img.shields.io/badge/arXiv-2410.05779-b31b1b'></a>
 
10
  <img src='https://img.shields.io/github/stars/hkuds/lightrag?color=green&style=social' />
11
  </p>
12
  <p>
 
20
  </div>
21
 
22
  ## πŸŽ‰ News
23
+ - [x] [2024.10.16]πŸŽ―πŸŽ―πŸ“’πŸ“’LightRAG now supports Ollama models!
24
  - [x] [2024.10.15]πŸŽ―πŸŽ―πŸ“’πŸ“’LightRAG now supports Hugging Face models!
25
 
26
  ## Install
 
37
  ```
38
 
39
  ## Quick Start
40
+ * All the code can be found in the `examples`.
41
  * Set OpenAI API key in environment if using OpenAI models: `export OPENAI_API_KEY="sk-...".`
42
  * Download the demo text "A Christmas Carol by Charles Dickens":
43
  ```bash
 
84
  # Initialize LightRAG with Hugging Face model
85
  rag = LightRAG(
86
  working_dir=WORKING_DIR,
87
+ llm_model_func=hf_model_complete, # Use Hugging Face model for text generation
88
  llm_model_name='meta-llama/Llama-3.1-8B-Instruct', # Model name from Hugging Face
89
  # Use Hugging Face embedding function
90
  embedding_func=EmbeddingFunc(
 
98
  ),
99
  )
100
  ```
101
+ ### Using Ollama Models
102
+ If you want to use Ollama models, you only need to set LightRAG as follows:
103
+ ```python
104
+ from lightrag.llm import ollama_model_complete, ollama_embedding
105
+
106
+ # Initialize LightRAG with Ollama model
107
+ rag = LightRAG(
108
+ working_dir=WORKING_DIR,
109
+ llm_model_func=ollama_model_complete, # Use Ollama model for text generation
110
+ llm_model_name='your_model_name', # Your model name
111
+ # Use Ollama embedding function
112
+ embedding_func=EmbeddingFunc(
113
+ embedding_dim=768,
114
+ max_token_size=8192,
115
+ func=lambda texts: ollama_embedding(
116
+ texts,
117
+ embed_model="nomic-embed-text"
118
+ )
119
+ ),
120
+ )
121
+ ```
122
  ### Batch Insert
123
  ```python
124
  # Batch Insert: Insert multiple texts at once
 
347
  β”œβ”€β”€ examples
348
  β”‚ β”œβ”€β”€ batch_eval.py
349
  β”‚ β”œβ”€β”€ generate_query.py
350
+ β”‚ β”œβ”€β”€ lightrag_hf_demo.py
351
+ β”‚ β”œβ”€β”€ lightrag_ollama_demo.py
352
+ β”‚ β”œβ”€β”€ lightrag_openai_compatible_demo.py
353
+ β”‚ └── lightrag_openai_demo.py
354
  β”œβ”€β”€ lightrag
355
  β”‚ β”œβ”€β”€ __init__.py
356
  β”‚ β”œβ”€β”€ base.py