From 6be7901df263900a9f6eeddd162f111996636e81 Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Wed, 20 Nov 2024 17:09:28 +0800 Subject: [PATCH] Warning instead of exception on type mismatch (#3523) ### What problem does this PR solve? Warning instead of exception on type mismatch. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/ragflow_server.py | 5 +++-- rag/svr/task_executor.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/ragflow_server.py b/api/ragflow_server.py index db063da2c..056f05610 100644 --- a/api/ragflow_server.py +++ b/api/ragflow_server.py @@ -14,8 +14,9 @@ # limitations under the License. # -from beartype.claw import beartype_packages -beartype_packages(["agent", "api", "deepdoc", "plugins", "rag", "ragflow_sdk"]) # <-- raise exceptions in your code +from beartype import BeartypeConf +from beartype.claw import beartype_all # <-- you didn't sign up for this +beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code import logging from api.utils.log_utils import initRootLogger diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py index 8a38389d4..3a0a9302b 100644 --- a/rag/svr/task_executor.py +++ b/rag/svr/task_executor.py @@ -13,8 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from beartype.claw import beartype_packages -beartype_packages(["agent", "api", "deepdoc", "plugins", "rag", "ragflow_sdk"]) # <-- raise exceptions in your code +from beartype import BeartypeConf +from beartype.claw import beartype_all # <-- you didn't sign up for this +beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code import logging import sys