feat: add gapgpt
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\GapGpt;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class GapGptApi
|
||||
{
|
||||
public static function chat($messages, $model = null)
|
||||
{
|
||||
$token = config('services.gapgpt.key');
|
||||
$baseUrl = rtrim(config('services.gapgpt.base_url'), '/');
|
||||
|
||||
return Http::withHeaders([
|
||||
'authorization' => 'Bearer ' . $token,
|
||||
])->post($baseUrl . '/chat/completions', [
|
||||
'model' => $model ?: config('services.gapgpt.model'),
|
||||
'messages' => $messages,
|
||||
'temperature' => 0.2,
|
||||
'max_tokens' => 4096,
|
||||
'top_p' => 1,
|
||||
'stream' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user