reduce warn (#225)

This commit is contained in:
zhuzhongshu123 2025-01-07 16:39:29 +08:00 committed by GitHub
parent a56d8a88a4
commit 16767f7e84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -9,15 +9,17 @@
# Unless required by applicable law or agreed to in writing, software distributed under the License # Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. # or implied.
import logging
from kag.interface import PromptABC from kag.interface import PromptABC
logger = logging.getLogger(__name__)
def init_prompt_with_fallback(prompt_name, biz_scene): def init_prompt_with_fallback(prompt_name, biz_scene):
try: try:
return PromptABC.from_config({"type": f"{biz_scene}_{prompt_name}"}) return PromptABC.from_config({"type": f"{biz_scene}_{prompt_name}"})
except Exception as e: except Exception as e:
print( logger.debug(
f"fail to initialize prompts with biz scene {biz_scene}, fallback to default biz scene, info: {e}" f"fail to initialize prompts with biz scene {biz_scene}, fallback to default biz scene, info: {e}"
) )

View File

@ -809,7 +809,7 @@ class Registrable:
params.clear() params.clear()
setattr(instant, "__from_config_kwargs__", remaining_kwargs) setattr(instant, "__from_config_kwargs__", remaining_kwargs)
except Exception as e: except Exception as e:
logger.warn(f"Failed to initialize class {cls}, info: {e}") logger.debug(f"Failed to initialize class {cls}, info: {e}")
raise e raise e
if len(params) > 0: if len(params) > 0:
logger.warn(f"These params are not used for constructing {cls}:\n{params}") logger.warn(f"These params are not used for constructing {cls}:\n{params}")