<?php
$api_key = "";
$prompt = "";
$url = "https://api.openai.com/v1/chat/completions";
$data = array(
"model" => "gpt-3.5-turbo",
"messages" => array(
array(
"role" => "user",
"content" => $prompt
)
),
"max_tokens" => 3000,
"temperature" => 0.5,
);
$data_string = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Authorization: Bearer $api_key",
"Content-Length: " . strlen($data_string))
);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>
https://platform.openai.com/docs/models/gpt-4
'푸닥거리' 카테고리의 다른 글
CodeGPT 기능 활용 with vscode (0) | 2023.03.23 |
---|---|
메타인지 교수법 (0) | 2023.03.13 |
2023년기준 일학습병행제 - 1 (0) | 2023.01.26 |
.NET TLS versioncompilation targetFramework httpRuntime targetFramework (0) | 2022.08.02 |
Spring Cloud를 활용한 MSA 설치 및 구성-2 (0) | 2022.07.24 |
댓글