Files
ocr/test006.py
2025-08-14 16:04:59 +08:00

28 lines
959 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
from openai import OpenAI
client = OpenAI(
# 若没有配置环境变量请用百炼API Key将下行替换为api_key="sk-xxx",
api_key="sk-01d13a39e09844038322108ecdbd1bbc",
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)
system_content="""
要求:使用可以让小学一年级的学生能懂的方式方法去解答
"""
user_content = """
鸡和兔在一个笼子里从上面数有8个头从下面数有26只脚。问鸡和兔各有几只?
要求:使用大学生层次的方法去解答
"""
completion = client.chat.completions.create(
model="qwen2.5-math-72b-instruct",
# 此处以qwen-vl-plus为例可按需更换模型名称。模型列表https://help.aliyun.com/zh/model-studio/getting-started/models
messages=[
# {"role": "system", "content": system_content},
{"role": "user",
"content": user_content}
]
)
print(completion.model_dump_json())