Skip to content

Commit 4b7e53f

Browse files
committed
Udpate readme
1 parent 59993d5 commit 4b7e53f

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

README.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Laravel Groq Package
1+
# Groq Laravel package
2+
3+
Laravel package to provide access to the [Groq REST API](https://console.groq.com/docs) using the [Groq-PHP library](https://github.com/lucianotonet/groq-php).
24

3-
This package provides integration for using the lucianotonet/groq-php package within Laravel 11 applications.
45

56
## Installation
67

@@ -10,31 +11,47 @@ You can install the package via composer:
1011
composer require lucianotonet/groq-laravel
1112
```
1213

13-
## Usage
14+
### Set up your keys
1415

15-
### Groq Facade
16+
Set your [Groq API key](https://console.groq.com/keys) on the `.env` file:
1617

17-
You can use the `Groq` facade to interact with the Groq package:
18-
19-
```php
20-
use LucianoTonet\GroqLaravel\Facades\Groq;
18+
```.env
19+
GROQ_API_KEY=gsk_...
20+
```
2121

22-
// Example usage
23-
$result = Groq::query('your_groq_query_here');
22+
If you need, you can set an alternative proxy base URL:
2423
```
24+
GROQ_API_BASE_URL=https://api.groq.com/openai/v1 # can be overitten by request
25+
```
2526

26-
### GroqServiceProvider
27+
## Usage
2728

28-
The `GroqServiceProvider` is automatically registered by Laravel and provides the binding for the `Groq` class:
29+
### Groq Facade
30+
31+
You can use the `Groq` facade to interact with the Groq package:
2932

3033
```php
31-
use LucianoTonet\GroqLaravel\Groq;
34+
use Illuminate\Support\Facades\Route;
35+
use LucianoTonet\GroqLaravel\Facades\Groq;
3236

33-
// Example usage within a service or controller
34-
$groq = app('Groq');
35-
$result = $groq->query('your_groq_query_here');
37+
Route::get('/', function () {
38+
$groq = new Groq();
39+
40+
$chatCompletion = $groq->chat()->completions()->create([
41+
'model' => 'llama2-70b-4096', // llama2-70b-4096, mixtral-8x7b-32768, gemma-7b-it
42+
'messages' => [
43+
[
44+
'role' => 'user',
45+
'content' => 'Explain the importance of low latency LLMs'
46+
]
47+
],
48+
]);
49+
50+
return $chatCompletion['choices'][0]['message']['content'];
51+
});
3652
```
3753

3854
## License
3955

4056
This package is open-sourced software licensed under the MIT license. See the [LICENSE](LICENSE) file for more information.
57+

0 commit comments

Comments
 (0)