タイトル: other-chatGPT レコード
カテゴリ: その他
タグ: [人工知能, AI, ロボット, chatGPT]
日付: 2023-02-02 10:04:33
コメント: false
mathjax: true
toc: true
その他のチャットGPTレコード
前編
- 公式ウェブサイト
- https://openai.com/
- API - https://openai.com/api/
- テスト - https://platform.openai.com/playground
- ChatGPT を WeChat に接続してインテリジェントな応答を実現 - https://www.cnblogs.com/zhayujie/p/16989904.html
- 登録チュートリアル - https://www.cnblogs.com/damugua/p/16969508.html
- ChatGPT は Postman 呼び出しテストに API を使用します - https://www.ossez.com/t/chatgpt-api-postman/14279
使用
- 米国の VPN を選択してください
- 登録ログイン
- API キーの生成: https://platform.openai.com/account/api-keys
- 関連する API
- テキスト: https://platform.openai.com/docs/api-reference/completions
- 画像: https://platform.openai.com/docs/api-reference/images
- 編集: https://platform.openai.com/docs/api-reference/edits
- 入力と指示に従い、結果を返します
ウェブテスト
-
https://platform.openai.com/playground
-
テキストを入力し、送信をクリックします
API
- https://platform.openai.com/docs/api-reference/completions/create
API は米国ノードを使用できませんが、香港でも使用できます
テキストAPI
-
ドキュメント: https://platform.openai.com/docs/api-reference/completions
-
投稿メソッドを使用する
url = "https://api.openai.com/v1/completions" headers = { "Content-Type": "application/json", "Authorization": "Bearer " + kApiKey, # kApiKey 为 api key: https://platform.openai.com/account/api-keys } data = { "model": "text-davinci-003", "prompt": "人类什么时候灭绝", "max_tokens": 1024, # 最大单词数 "n": 1, # 生成数量, 1-10 } httpCode, rspDct = utils.httpPost(url=url, dct=data, headers=headers) print("--- rsp, code: {}, text: {}".format(httpCode, utils.beautyJson(rspDct))) assert httpCode == 200, "--- 请求失败, code: {}, url: {}".format(httpCode, url)
-
結果が出るまで数秒待ちます
{ "id": "cmpl-6fPbsfcv5kHUW5ca7YfAARcjwpgzp", "object": "text_completion", "created": 1675327912, "model": "text-davinci-003", "choices": [ { "text": "?\n\n我们无法准确预测人类的末日,但是能够估计,灭绝可能会发生在几百万至几十亿年后,也有可能会发生在未来几年内。原因是人类受到某些因素的威胁,包括气候变化,核战争以及全球大规模流行病等。在下一次大灾难发生之前,人类可能会繁衍更多后代,但最终无论是什么,我们的存在都是暂时的。", "index": 0, "logprobs": null, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 19, "completion_tokens": 285, "total_tokens": 304 } }
フェイシュはchatGPTにアクセスします
-
上の写真