文档

快速开始

更新时间:
重要

Dolly模型API调用需"申请体验"并通过后才可使用,否则API调用将返回错误状态码。

Dolly

说明

支持的领域 / 任务:aigc

Dolly模型是由Databricks出品的大规模语言模型,它在灵积平台上的模型名称为"dolly-12b-v2"。该模型是在pythia-12b的基础上,使用databricks-dolly-15k数据集微调得到的。数据集包括头脑风暴、分类、生成、问答、信息抽取等任务的语料。更多信息可以参考Dolly的开源repo

快速开始

前提条件

示例代码

以下示例展示了调用Dolly API对一个用户指令进行响应的代码。

说明

需要使用您的API-KEY替换示例中的 your-dashscope-api-key ,代码才能正常运行。

# For prerequisites running the following sample, visit https://help.aliyun.com/document_detail/611472.html

import dashscope
from dashscope import Generation
from http import HTTPStatus

dashscope.api_key='your-dashscope-api-key'

response = Generation.call(
    model='dolly-12b-v2',
    prompt='翻一下:春天来了,花朵都开了。'
)
# The response status_code is HTTPStatus.OK indicate success,
# otherwise indicate request is failed, you can get error code
# and message from code and message.
if response.status_code == HTTPStatus.OK:
    print(response.output)  # The output text
    print(response.usage)  # The usage information
else:
    print(response.code)  # The error code.
    print(response.message)  # The error message.

调用成功后,将会返回如下示例结果。

{"text": "Spring has come, flowers blossomed."}
{"input_tokens": 0, "output_tokens": 0}

了解更多

有关Dolly模型API的详细调用文档可前往API详情页面进行了解。

  • 本页导读 (0)
文档反馈