zrguo commited on
Commit
69f7306
·
2 Parent(s): 19e8b35 4ea4897

Merge pull request #168 from Dormiveglia-elf/hotfix/asynchronous

Browse files
examples/lightrag_openai_compatible_demo.py CHANGED
@@ -69,25 +69,25 @@ async def main():
69
  )
70
 
71
  with open("./book.txt", "r", encoding="utf-8") as f:
72
- rag.insert(f.read())
73
 
74
  # Perform naive search
75
  print(
76
- rag.query(
77
  "What are the top themes in this story?", param=QueryParam(mode="naive")
78
  )
79
  )
80
 
81
  # Perform local search
82
  print(
83
- rag.query(
84
  "What are the top themes in this story?", param=QueryParam(mode="local")
85
  )
86
  )
87
 
88
  # Perform global search
89
  print(
90
- rag.query(
91
  "What are the top themes in this story?",
92
  param=QueryParam(mode="global"),
93
  )
@@ -95,7 +95,7 @@ async def main():
95
 
96
  # Perform hybrid search
97
  print(
98
- rag.query(
99
  "What are the top themes in this story?",
100
  param=QueryParam(mode="hybrid"),
101
  )
 
69
  )
70
 
71
  with open("./book.txt", "r", encoding="utf-8") as f:
72
+ await rag.ainsert(f.read())
73
 
74
  # Perform naive search
75
  print(
76
+ await rag.aquery(
77
  "What are the top themes in this story?", param=QueryParam(mode="naive")
78
  )
79
  )
80
 
81
  # Perform local search
82
  print(
83
+ await rag.aquery(
84
  "What are the top themes in this story?", param=QueryParam(mode="local")
85
  )
86
  )
87
 
88
  # Perform global search
89
  print(
90
+ await rag.aquery(
91
  "What are the top themes in this story?",
92
  param=QueryParam(mode="global"),
93
  )
 
95
 
96
  # Perform hybrid search
97
  print(
98
+ await rag.aquery(
99
  "What are the top themes in this story?",
100
  param=QueryParam(mode="hybrid"),
101
  )