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.
|
73 |
|
74 |
# Perform naive search
|
75 |
print(
|
76 |
-
rag.
|
77 |
"What are the top themes in this story?", param=QueryParam(mode="naive")
|
78 |
)
|
79 |
)
|
80 |
|
81 |
# Perform local search
|
82 |
print(
|
83 |
-
rag.
|
84 |
"What are the top themes in this story?", param=QueryParam(mode="local")
|
85 |
)
|
86 |
)
|
87 |
|
88 |
# Perform global search
|
89 |
print(
|
90 |
-
rag.
|
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.
|
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 |
)
|