25 lines
573 B
PHP
25 lines
573 B
PHP
<?php
|
|
|
|
namespace App\Modules\Groq;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class GroqApi
|
|
{
|
|
public static function chat($messages)
|
|
{
|
|
$token = config('services.groq.key');
|
|
|
|
return Http::withHeaders([
|
|
'authorization' => 'Bearer ' . $token,
|
|
])->post('https://api.groq.com/openai/v1/chat/completions', [
|
|
'model' => 'llama-3.3-70b-versatile',
|
|
'messages' => $messages,
|
|
'temperature' => 0.2,
|
|
'max_tokens' => 4096,
|
|
'top_p' => 1,
|
|
'stream' => false
|
|
]);
|
|
}
|
|
}
|