質問編集履歴

2

コードの追加

2021/03/08 12:23

投稿

spa
spa

スコア52

test CHANGED
File without changes
test CHANGED
@@ -108,4 +108,60 @@
108
108
 
109
109
 
110
110
 
111
+ function gpt_3() {
112
+
113
+ var uri = 'https://api.openai.com/v1/engines/davinci/completions';
114
+
115
+
116
+
117
+ var options = {
118
+
119
+ "method":"post",
120
+
121
+ "Content-type": "application/json",
122
+
123
+ "Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
124
+
125
+ "payload": JSON.stringify(json)
126
+
127
+ };
128
+
129
+
130
+
131
+ var json = {
132
+
133
+ "id": "cmpl-GERzeJQ4lvqPk8SkZu4XMIuR",
134
+
135
+ "object": "text_completion",
136
+
137
+ "created": 1586839808,
138
+
139
+ "model": "davinci:2020-05-03",
140
+
141
+ "choices": [{
142
+
143
+ "text": " of reading speed. You",
144
+
111
- ここにより詳細な情報を記載してください。
145
+ "index": 0,
146
+
147
+ "logprobs": null,
148
+
149
+ "finish_reason": "length"
150
+
151
+ }]
152
+
153
+ }
154
+
155
+
156
+
157
+ UrlFetchApp.fetch(uri, {"json": json, "headers": options});
158
+
159
+
160
+
161
+ }
162
+
163
+
164
+
165
+ に変更したところ、Exception: Attribute provided with invalid value: Header:null
166
+
167
+ とエラーが出て進めなくなりました。

1

画像の追加

2021/03/08 12:23

投稿

spa
spa

スコア52

test CHANGED
File without changes
test CHANGED
@@ -27,6 +27,18 @@
27
27
  ![イメージ説明](70e85bcb01eb6d798b0fc8a4b8f5eec5.png)
28
28
 
29
29
  ![イメージ説明](efdea6b76ebb063155f0751b8b72686a.png)
30
+
31
+
32
+
33
+ Node.js用のチュートリアルがありましたが、GASでの応用の仕方がわかりませんでした。
34
+
35
+ https://www.twilio.com/blog/getting-started-with-openai-s-gpt-3-in-node-js
36
+
37
+ ![イメージ説明](e7548a95edc9feb0cb8d1828bdfaeba1.png)
38
+
39
+
40
+
41
+
30
42
 
31
43
 
32
44