main
HuangHai 2 weeks ago
parent 66104f4447
commit 341e88b6c5

@ -7,16 +7,20 @@ try:
api_key='sk-f6da0c787eff4b0389e4ad03a35a911f', api_key='sk-f6da0c787eff4b0389e4ad03a35a911f',
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", 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( completion = client.chat.completions.create(
# 模型列表https://help.aliyun.com/zh/model-studio/getting-started/models # 模型列表https://help.aliyun.com/zh/model-studio/getting-started/models
model="qwen-plus", model="qwen-plus",
messages=[ messages=[
{"role": "system", "content": "You are a helpful assistant."}, {"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "你是谁?"}, {"role": "user",
"content": "我将提供一份markdown格式的试卷帮我整理出每道题的题目序号内容答案解析并最终输出一共整理了多少道题。内容如下" + text},
], ],
) )
print(completion.choices[0].message.content) print(completion.choices[0].message.content)
except Exception as e: except Exception as e:
print(f"错误信息:{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")

Loading…
Cancel
Save