LLPhant icon indicating copy to clipboard operation
LLPhant copied to clipboard

Integration with GroqCloud

Open Gudetomi opened this issue 1 year ago • 2 comments

Integration with GroqCloud

https://groq.com/

It makes several models available quickly, has a limited but very efficient free service.

Gudetomi avatar Aug 15 '24 11:08 Gudetomi

Hey @Gudetomi . It is a very good idea. Do you want to try to make a PR to implement it?

If yes, you need to create a class that implement ChatInterface.php but you don't need to implement everything. At least generateText. You can see example for other providers in the code.

MaximeThoonsen avatar Aug 18 '24 21:08 MaximeThoonsen

Great idea! However, using Groq is already quite simple:

You can leverage the OpenAPI provider with a different base URL and model.

All you need really is:

$config = new OpenAIConfig();
$config->model = 'llama-3.1-8b-instant'; // Or some other model from the Groq Docs
$config->apiKey = '...'; // your GroqCloud API key
$config->url = 'https://api.groq.com/openai/v1';
$chat = new OpenAIChat($config);
$chat->setSystemMessage('You are funny and you know it.');
$response = $chat->generateText('Tell me a simple joke!');

rikgirbes avatar Mar 18 '25 10:03 rikgirbes