|
|
|
@ -7,16 +7,20 @@ try:
|
|
|
|
|
api_key='sk-f6da0c787eff4b0389e4ad03a35a911f',
|
|
|
|
|
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
|
|
|
)
|
|
|
|
|
# 读取md文件内容
|
|
|
|
|
with open("2、识别出结果.md", "r", encoding="utf-8") as f:
|
|
|
|
|
text = f.read()
|
|
|
|
|
|
|
|
|
|
completion = client.chat.completions.create(
|
|
|
|
|
# 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
|
|
|
|
|
model="qwen-plus",
|
|
|
|
|
messages=[
|
|
|
|
|
{"role": "system", "content": "You are a helpful assistant."},
|
|
|
|
|
{"role": "user", "content": "你是谁?"},
|
|
|
|
|
{"role": "user",
|
|
|
|
|
"content": "我将提供一份markdown格式的试卷,帮我整理出每道题的题目序号,内容,答案,解析,并最终输出一共整理了多少道题。内容如下:" + text},
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
print(completion.choices[0].message.content)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(f"错误信息:{e}")
|
|
|
|
|
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
|
|
|
|
|
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
|
|
|
|
|