MCPcopy Create free account
hub / github.com/Enfoirer/Text2GraphRAG / aquery

Method aquery

nano_graphrag/graphrag.py:236–275  ·  view source on GitHub ↗
(self, query: str, param: QueryParam = QueryParam())

Source from the content-addressed store, hash-verified

234 return loop.run_until_complete(self.aquery(query, param))
235
236 async def aquery(self, query: str, param: QueryParam = QueryParam()):
237 if param.mode == "local" and not self.enable_local:
238 raise ValueError("enable_local is False, cannot query in local mode")
239 if param.mode == "naive" and not self.enable_naive_rag:
240 raise ValueError("enable_naive_rag is False, cannot query in naive mode")
241 if param.mode == "local":
242 response = await local_query(
243 query,
244 self.chunk_entity_relation_graph,
245 self.entities_vdb,
246 self.community_reports,
247 self.text_chunks,
248 param,
249 self.tokenizer_wrapper,
250 asdict(self),
251 )
252 elif param.mode == "global":
253 response = await global_query(
254 query,
255 self.chunk_entity_relation_graph,
256 self.entities_vdb,
257 self.community_reports,
258 self.text_chunks,
259 param,
260 self.tokenizer_wrapper,
261 asdict(self),
262 )
263 elif param.mode == "naive":
264 response = await naive_query(
265 query,
266 self.chunks_vdb,
267 self.text_chunks,
268 param,
269 self.tokenizer_wrapper,
270 asdict(self),
271 )
272 else:
273 raise ValueError(f"Unknown mode {param.mode}")
274 await self._query_done()
275 return response
276
277 async def ainsert(self, string_or_strings):
278 await self._insert_start()

Callers 1

queryMethod · 0.95

Calls 5

_query_doneMethod · 0.95
QueryParamClass · 0.85
local_queryFunction · 0.85
global_queryFunction · 0.85
naive_queryFunction · 0.85

Tested by

no test coverage detected