Request id: 01a480ae-57b1-9876-b496-ea5529730d15, Status code: 403, error code: AccessDenied, error message: Access denied.
换模型换api_key,还是这样,我用的示例调用
from http import HTTPStatus
import dashscope
dashscope.api_key = "我的API_KEY"
def call_with_messages():
messages = [{'role': 'system', 'content': 'You are a helpful assistant.'},
{'role': 'user', 'content': '你好'}]
response = dashscope.Generation.call(
model='baichuan2-turbo',
messages=messages,
)
if response.status_code == HTTPStatus.OK:
print(response)
else:
print('Request id: %s, Status code: %s, error code: %s, error message: %s' % (
response.request_id, response.status_code,
response.code, response.message
))
if name == 'main':
call_with_messages()