<?php
$apiKey = 'APIキー';
$endpoint = 'https://api.openai.com/v1/chat/completions';
$headers = array(
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey
);
$user_question = isset($_POST['user_question_s']) ? $_POST['user_question_s'] : '';
$article = array(
'model' => 'gpt-3.5-turbo',
'messages' => [
[
'role' => 'system',
'content' => '口コミで使える文章を口コミと言う言葉を使わずに50文字の日本語で考えて'
],
[
'role' => 'user',
'content' => $user_question
]
],
'max_tokens' => 100
);
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme