Fix linting
This commit is contained in:
@@ -1198,7 +1198,6 @@ async def mix_kg_vector_query(
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
# 3. Execute both retrievals in parallel
|
# 3. Execute both retrievals in parallel
|
||||||
kg_context, vector_context = await asyncio.gather(
|
kg_context, vector_context = await asyncio.gather(
|
||||||
get_kg_context(), _get_vector_context(query, chunks_vdb, query_param, tokenizer)
|
get_kg_context(), _get_vector_context(query, chunks_vdb, query_param, tokenizer)
|
||||||
@@ -2223,10 +2222,12 @@ async def _get_vector_context(
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Reduce top_k for vector search in hybrid mode since we have structured information from KG
|
# Reduce top_k for vector search in hybrid mode since we have structured information from KG
|
||||||
mix_topk = min(10, query_param.top_k) if hasattr(query_param, 'mode') and query_param.mode == 'mix' else query_param.top_k
|
mix_topk = (
|
||||||
results = await chunks_vdb.query(
|
min(10, query_param.top_k)
|
||||||
query, top_k=mix_topk, ids=query_param.ids
|
if hasattr(query_param, "mode") and query_param.mode == "mix"
|
||||||
|
else query_param.top_k
|
||||||
)
|
)
|
||||||
|
results = await chunks_vdb.query(query, top_k=mix_topk, ids=query_param.ids)
|
||||||
if not results:
|
if not results:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -2254,9 +2255,7 @@ async def _get_vector_context(
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
f"Truncate chunks from {len(valid_chunks)} to {len(maybe_trun_chunks)} (max tokens:{query_param.max_token_for_text_unit})"
|
f"Truncate chunks from {len(valid_chunks)} to {len(maybe_trun_chunks)} (max tokens:{query_param.max_token_for_text_unit})"
|
||||||
)
|
)
|
||||||
logger.info(
|
logger.info(f"Vector query: {len(maybe_trun_chunks)} chunks, top_k: {mix_topk}")
|
||||||
f"Vector query: {len(maybe_trun_chunks)} chunks, top_k: {mix_topk}"
|
|
||||||
)
|
|
||||||
|
|
||||||
if not maybe_trun_chunks:
|
if not maybe_trun_chunks:
|
||||||
return None
|
return None
|
||||||
@@ -2277,6 +2276,7 @@ async def _get_vector_context(
|
|||||||
logger.error(f"Error in _get_vector_context: {e}")
|
logger.error(f"Error in _get_vector_context: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def query_with_keywords(
|
async def query_with_keywords(
|
||||||
query: str,
|
query: str,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
|
Reference in New Issue
Block a user