Skip to content

Commit

Permalink
change logger.error to logger.exception (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyeh authored Jun 27, 2024
1 parent 0075994 commit 85cd002
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion wren-ai-service/src/pipelines/ask/query_understanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def run(self, replies: List[str]):
"is_valid_query": False,
}
except Exception as e:
logger.error(f"Error in QueryUnderstandingPostProcessor: {e}")
logger.exception(f"Error in QueryUnderstandingPostProcessor: {e}")

return {
"is_valid_query": True,
Expand Down
12 changes: 7 additions & 5 deletions wren-ai-service/src/web/v1/services/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def get_prepare_semantics_status(
prepare_semantics_status_request.id
)
) is None:
logger.error(
logger.exception(
f"ask pipeline - id is not found for SemanticsPreparation: {prepare_semantics_status_request.id}"
)
return SemanticsPreparationStatusResponse(
Expand Down Expand Up @@ -184,7 +184,7 @@ async def ask(
)

if not query_understanding_result["post_process"]["is_valid_query"]:
logger.error(
logger.exception(
f"ask pipeline - MISLEADING_QUERY: {ask_request.query}"
)
self._ask_results[query_id] = AskResultResponse(
Expand All @@ -207,7 +207,7 @@ async def ask(
documents = retrieval_result.get("retrieval", {}).get("documents", [])

if not documents:
logger.error(
logger.exception(
f"ask pipeline - NO_RELEVANT_DATA: {ask_request.query}"
)
self._ask_results[query_id] = AskResultResponse(
Expand Down Expand Up @@ -309,7 +309,9 @@ async def ask(
logger.debug(f"valid_generation_results: {valid_generation_results}")

if not valid_generation_results and not historical_question_result:
logger.error(f"ask pipeline - NO_RELEVANT_SQL: {ask_request.query}")
logger.exception(
f"ask pipeline - NO_RELEVANT_SQL: {ask_request.query}"
)
self._ask_results[query_id] = AskResultResponse(
status="failed",
error=AskResultResponse.AskError(
Expand Down Expand Up @@ -366,7 +368,7 @@ def get_ask_result(
ask_result_request: AskResultRequest,
) -> AskResultResponse:
if (result := self._ask_results.get(ask_result_request.query_id)) is None:
logger.error(
logger.exception(
f"ask pipeline - OTHERS: {ask_result_request.query_id} is not found"
)
return AskResultResponse(
Expand Down
2 changes: 1 addition & 1 deletion wren-ai-service/src/web/v1/services/ask_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_ask_details_result(
if (
result := self._ask_details_results.get(ask_details_result_request.query_id)
) is None:
logger.error(
logger.exception(
f"ask-details pipeline - OTHERS: {ask_details_result_request.query_id} is not found"
)
return AskDetailsResultResponse(
Expand Down

0 comments on commit 85cd002

Please sign in to comment.