test_yaml.py 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import os
  2. import sys
  3. sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
  4. import yaml
  5. from logger.loggering import server_logger
  6. from utils.yaml_utils import system_prompt_config , get_business_scene_prompt
  7. # 测试yaml 文件读取
  8. def test_get_system_prompt():
  9. system_prompt = system_prompt_config
  10. server_logger.info(f"获取系统提示语,template: {system_prompt["template"]}")
  11. # 获取任务 提示词
  12. def test_get_task_prompt():
  13. #business_scene = "common_model_query"
  14. #business_scene = "cattle_farm_common"
  15. #business_scene = "cattle_farm_query"
  16. business_scene = "cattle_farm_warning_plan"
  17. #business_scene = "cattle_farm_warning_task_execute"
  18. business_scene_enum , task_prompt_config = get_business_scene_prompt(business_scene)
  19. server_logger.info(f"获取系统提示语,business_scene_enum:{business_scene_enum},task_prompt: {task_prompt_config["task_prompt"]}")
  20. server_logger.info(f"获取系统提示语,business_scene_enum:{business_scene_enum},template: {task_prompt_config["template"]}")
  21. if __name__ == '__main__':
  22. #test_get_system_prompt() # 获取系统提示语
  23. test_get_task_prompt() # 获取任务 提示词