init
This commit is contained in:
27
test006.py
Normal file
27
test006.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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())
|
Reference in New Issue
Block a user