You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
import dashscope
|
|
|
|
|
|
|
|
|
|
messages = [
|
|
|
|
|
{'role': 'system', 'content': 'You are a helpful assistant.'},
|
|
|
|
|
{'role': 'user', 'content': '你是谁?'}
|
|
|
|
|
]
|
|
|
|
|
response = dashscope.Generation.call(
|
|
|
|
|
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",
|
|
|
|
|
api_key='sk-01d13a39e09844038322108ecdbd1bbc',
|
|
|
|
|
model="qwen-plus", # 此处以qwen-plus为例,可按需更换模型名称。模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
|
|
|
|
|
messages=messages,
|
|
|
|
|
result_format='message'
|
|
|
|
|
)
|
|
|
|
|
print(response)
|