11.8采购要求更加完整
This commit is contained in:
parent
d6ab5f8f1b
commit
608367ca25
@ -79,6 +79,36 @@ def qianwen_long_text(file_id, user_query):
|
|||||||
# Return the response content
|
# Return the response content
|
||||||
return completion.choices[0].message.content
|
return completion.choices[0].message.content
|
||||||
|
|
||||||
|
def qianwen_long_stream(file_id, user_query):
|
||||||
|
print("call qianwen-long text...")
|
||||||
|
"""
|
||||||
|
Uses a previously uploaded file to generate a response based on a user query.
|
||||||
|
"""
|
||||||
|
client = OpenAI(
|
||||||
|
api_key=os.getenv("DASHSCOPE_API_KEY"),
|
||||||
|
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Generate a response based on the file ID
|
||||||
|
completion = client.chat.completions.create(
|
||||||
|
model="qwen-long",
|
||||||
|
# top_p=0.5,
|
||||||
|
temperature=0.5,
|
||||||
|
messages=[
|
||||||
|
{
|
||||||
|
'role': 'system',
|
||||||
|
'content': f'fileid://{file_id}'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'role': 'user',
|
||||||
|
'content': user_query
|
||||||
|
}
|
||||||
|
],
|
||||||
|
stream=True
|
||||||
|
)
|
||||||
|
# Return the response content
|
||||||
|
return completion.choices[0].message.content
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Example file path - replace with your actual file path
|
# Example file path - replace with your actual file path
|
||||||
|
|
||||||
|
@ -82,13 +82,12 @@ def get_business_requirements(truncate_file,file_id):
|
|||||||
#一起问了,效率慢点,但内容准
|
#一起问了,效率慢点,但内容准
|
||||||
queries=[
|
queries=[
|
||||||
"""
|
"""
|
||||||
请你根据该货物类招标文件中的采购要求部分内容,请告诉我文档中技术要求、服务要求、商务要求、其他要求分别是什么,请以json格式返回结果,可以用嵌套键值对的形式组织回答,默认情况下外层键名是'技术要求','服务要求','商务要求','其他要求',内层键名是原文中的相应子标题或者是你对相关子要求的总结,而键值需要完全与原文保持一致,不可擅自总结删减。注意你无需回答采购清单中具体设备的技术参数要求,仅需从正文部分开始提取。以下是你需要考虑的特殊情况:如果原文中技术要求与服务要求在一块,那么你应该用外键'技术、服务要求'替换默认外键'技术要求'和'服务要求',若相关要求不存在,对应的键值设为'未知'。以下为示例输出,仅供格式参考:
|
请你根据该货物类招标文件中的采购要求部分内容,请告诉我文档中技术要求、服务要求、商务要求、其他要求分别是什么,你仅需定位到原文中相应位置并提取原文内容,通常一类要求写在一块大标题下,请以json格式返回结果,可以用嵌套键值对的形式组织回答,默认情况下外层键名是'技术要求','服务要求','商务要求','其他要求',内层键名是原文中的相应子标题或者是你对相关子要求的总结,而键值需要完全与原文保持一致,不可擅自总结删减。注意你无需回答采购清单中具体设备的技术参数要求,仅需从正文部分(采购清单之后)开始提取。以下是你需要考虑的特殊情况:如果原文中技术要求与服务要求在一块,那么你应该用外键'技术、服务要求'替换默认外键'技术要求'和'服务要求';若相关要求不存在,对应的键值设为'未知'。以下为示例输出,仅供格式参考:
|
||||||
{
|
{
|
||||||
"技术、服务要求":"相关技术要求以及服务要求",
|
"技术、服务要求":"相关技术要求以及服务要求",
|
||||||
"商务要求":"相关商务要求",
|
"商务要求":"相关商务要求",
|
||||||
"其他要求":"其他要求内容"
|
"其他要求":"其他要求内容"
|
||||||
}
|
}"""
|
||||||
"""
|
|
||||||
]
|
]
|
||||||
results = multi_threading(queries, "", file_id, 2)
|
results = multi_threading(queries, "", file_id, 2)
|
||||||
business_requirements = [res for _, res in results] if results else []
|
business_requirements = [res for _, res in results] if results else []
|
||||||
@ -99,7 +98,7 @@ def get_business_requirements(truncate_file,file_id):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
truncate_file = "C:\\Users\\Administrator\\Desktop\\fsdownload\\469d2aee-9024-4993-896e-2ac7322d41b7\\ztbfile_procurement.docx"
|
truncate_file = "C:\\Users\\Administrator\\Desktop\\fsdownload\\e4be098d-b378-4126-9c32-a742b237b3b1\\ztbfile_procurement.docx"
|
||||||
file_id = upload_file(truncate_file)
|
file_id = upload_file(truncate_file)
|
||||||
res=get_business_requirements(truncate_file,file_id)
|
res=get_business_requirements(truncate_file,file_id)
|
||||||
print(json.dumps(res, ensure_ascii=False, indent=4))
|
print(json.dumps(res, ensure_ascii=False, indent=4))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user