Slide 35
Slide 35 text
エンドポイント
● https://api.openai.com/v1/chat/completions
ヘッダー
● Autorization: APIトークン
● Content-Type: json
リクエストパラメーター
● model: 使用するモデルの名前
● messages:
○ role: system, user, assistant
○ content: プロンプト内容
http.post(
Uri.parse(endpoint),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $apiKey',
},
body: jsonEncode(
{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": prompt,
}
],
},
),
);