ChatGPT官方文档翻译3-库

库(Libraries)

Python库

我们提供了一个 Python 库,您可以按如下方式安装它:

$ pip install openai

安装后,您可以使用绑定和您的密钥运行以下命令:

import os
import openai

# Load your API key from an environment variable or secret management service
openai.api_key = os.getenv("OPENAI_API_KEY")

response = openai.Completion.create(model="text-davinci-003", prompt="Say this is a test", temperature=0, max_tokens=7)

这些绑定还会安装一个命令行实用程序,您可以按以下方式使用:

$ openai api completions.create -m text-davinci-003 -p "Say this is a test" -t 0 -M 7 --stream

Node.ji 库 https://platform.openai.com/docs/libraries/node-js-library

社区库 https://platform.openai.com/docs/libraries/community-libraries

全站侧栏

近期文章

发表评论