Fix linting

This commit is contained in:
yangdx
2025-05-07 03:57:14 +08:00
parent 910a7a8936
commit 2485bfe53c

View File

@@ -1198,7 +1198,6 @@ async def mix_kg_vector_query(
traceback.print_exc()
return None
# 3. Execute both retrievals in parallel
kg_context, vector_context = await asyncio.gather(
get_kg_context(), _get_vector_context(query, chunks_vdb, query_param, tokenizer)
@@ -2223,10 +2222,12 @@ async def _get_vector_context(
"""
try:
# 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
results = await chunks_vdb.query(
query, top_k=mix_topk, ids=query_param.ids
mix_topk = (
min(10, query_param.top_k)
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:
return None
@@ -2254,9 +2255,7 @@ async def _get_vector_context(
logger.debug(
f"Truncate chunks from {len(valid_chunks)} to {len(maybe_trun_chunks)} (max tokens:{query_param.max_token_for_text_unit})"
)
logger.info(
f"Vector query: {len(maybe_trun_chunks)} chunks, top_k: {mix_topk}"
)
logger.info(f"Vector query: {len(maybe_trun_chunks)} chunks, top_k: {mix_topk}")
if not maybe_trun_chunks:
return None
@@ -2277,6 +2276,7 @@ async def _get_vector_context(
logger.error(f"Error in _get_vector_context: {e}")
return None
async def query_with_keywords(
query: str,
prompt: str,