Skip to content

Commit d4c128a

Browse files
committed
Reformatted by Black
1 parent 3f589a0 commit d4c128a

2 files changed

Lines changed: 5 additions & 15 deletions

File tree

‎src/utils/reranker.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ async def _get_cross_encoder(model_name: str) -> Any:
5050
model = await asyncio.to_thread(CrossEncoder, model_name)
5151
_cross_encoder_models[model_name] = model
5252
logger.info("Loaded cross-encoder for RAG reranking: %s", model_name)
53-
except (
54-
Exception # pylint: disable=broad-exception-caught # noqa: BLE001
55-
) as e:
53+
except Exception as e: # pylint: disable=broad-exception-caught # noqa: BLE001
5654
logger.warning(
5755
"Could not load cross-encoder for reranking (%s): %s", model_name, e
5856
)
@@ -170,9 +168,7 @@ async def rerank_chunks_with_cross_encoder(
170168
for score, chunk in top_indexed
171169
]
172170

173-
except (
174-
Exception # pylint: disable=broad-exception-caught # noqa: BLE001
175-
) as e:
171+
except Exception as e: # pylint: disable=broad-exception-caught # noqa: BLE001
176172
logger.warning(
177173
"Cross-encoder reranking failed, falling back to original scoring: %s", e
178174
)

‎src/utils/vector_search.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,7 @@ async def _query_store_for_byok_rag( # pylint: disable=too-many-arguments,too-m
296296
},
297297
)
298298
return _extract_byok_rag_chunks(search_response, vector_store_id, weight)
299-
except (
300-
Exception # pylint: disable=broad-exception-caught # noqa: BLE001
301-
) as e:
299+
except Exception as e: # pylint: disable=broad-exception-caught # noqa: BLE001
302300
logger.warning("Failed to search '%s': %s", vector_store_id, e)
303301
return []
304302

@@ -569,9 +567,7 @@ async def _fetch_byok_rag( # pylint: disable=too-many-locals
569567
# Extract referenced documents from BYOK RAG chunks (now with resolved sources)
570568
referenced_documents = _process_byok_rag_chunks_for_documents(top_results)
571569

572-
except (
573-
Exception # pylint: disable=broad-exception-caught # noqa: BLE001
574-
) as e:
570+
except Exception as e: # pylint: disable=broad-exception-caught # noqa: BLE001
575571
logger.warning("Failed to perform BYOK RAG search: %s", e)
576572
logger.debug("BYOK RAG error details: %s", traceback.format_exc())
577573

@@ -640,9 +636,7 @@ async def _fetch_okp_rag( # pylint: disable=too-many-locals
640636
)
641637
logger.debug("OKP RAG returned %d chunks", len(rag_chunks))
642638

643-
except (
644-
Exception # pylint: disable=broad-exception-caught # noqa: BLE001
645-
) as e:
639+
except Exception as e: # pylint: disable=broad-exception-caught # noqa: BLE001
646640
logger.warning("Failed to query OKP for chunks: %s", e)
647641
logger.debug("OKP query error details: %s", traceback.format_exc())
648642

0 commit comments

Comments
 (0)