mirror of https://github.com/OpenSPG/KAG
reduce warn (#225)
This commit is contained in:
parent
a56d8a88a4
commit
16767f7e84
|
@ -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}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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}")
|
||||||
|
|
Loading…
Reference in New Issue