You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
from openpyxl import load_workbook
from Util import LlmUtil
# 要处理的Excel
excel_file = r ' D: \ dsWork \ dsProject \ dsLightRag \ Doc \ T1、史校长资料 \ 测试结果 \ 100题测试结果.xlsx '
if __name__ == ' __main__ ' :
prompt = """
请针对下面这两段文字【1】和【2】进行评分, 最高分为10分, 最低分为0分, 每1分差别为一个档次。
具体评分标准为:
只要【1】中包含【2】完全相同或者含义相同的内容, 即从【1】可以推理出【2】即视为正确, 打10分;
【1】中完全没有【2】表达的内容即视为错误打0分; 趋于中间的按照涵盖程度打分, 分越高越相似。
请注意:结果展示时,请按照如下标准进行输出:
先展示分析过程, 然后展示最终得分, 【最终得分】: x分, x替换为具体的分数, 范围从0到10的整数。
"""
wb = load_workbook ( excel_file )
ws = wb . active # 获取第一个sheet
query_text = prompt + " \n "
query_text = query_text + " 下面将提供两段文字: \n "
query_text = query_text + " 【1】: \n "
O2_content = ws [ ' O2 ' ] . value
query_text = query_text + O2_content + " \n "
query_text = query_text + " 【2】: \n "
O2_content = ws [ ' D2 ' ] . value
query_text = query_text + O2_content + " \n "
response = LlmUtil . get_llm_response ( query_text )
print ( response )
# 对比
# 【1】:O2,【2】:D2 内容
# 结果保存到 P2 (打分过程) Q2(通过正则表达式截取出的 【最终得分】)
wb . close ( )