Skip to content

Commit d4d0435

Browse files
committed
Update image URL and translate README
1 parent b9fb852 commit d4d0435

File tree

1 file changed

+71
-29
lines changed

1 file changed

+71
-29
lines changed

README.md

Lines changed: 71 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
# Groq Laravel
22

3-
![Groq Laravel](./docs/art.png)
3+
![Groq Laravel](https://raw.githubusercontent.com/lucianotonet/groq-laravel/v0.0.9/docs/art.png)
44

55
[![Latest Stable Version](https://poser.pugx.org/lucianotonet/groq-laravel/v)](https://packagist.org/packages/lucianotonet/groq-laravel) [![Total Downloads](https://poser.pugx.org/lucianotonet/groq-laravel/downloads)](https://packagist.org/packages/lucianotonet/groq-laravel) [![Latest Unstable Version](https://poser.pugx.org/lucianotonet/groq-laravel/v/unstable)](https://packagist.org/packages/lucianotonet/groq-laravel) [![License](https://poser.pugx.org/lucianotonet/groq-laravel/license)](https://packagist.org/packages/lucianotonet/groq-laravel) [![PHP Version Require](https://poser.pugx.org/lucianotonet/groq-laravel/require/php)](https://packagist.org/packages/lucianotonet/groq-laravel)
66

7-
Groq Laravel é um pacote poderoso para integração entre suas aplicações Laravel a API da [Groq](https://groq.com/), permitindo que você aproveite velocidades ultra-rápidas de inferência de IA com alguns dos LLMs mais populares, como o Llama3.1 ou Mixtral.
7+
Groq Laravel is a powerful package for integrating your Laravel applications with the [Groq](https://groq.com/) API, allowing you to leverage ultra-fast AI inference speeds with some of the most popular LLMs, such as Llama3.1 or Mixtral.
88

99
## Features
1010

11-
- **Interface Simples e Intuitiva:** Interaja com a API Groq usando a facade `Groq`, simplificando o acesso às funcionalidades de chat, tradução e transcrição de áudio e chamadas à funções.
12-
- **Tratamento Robusto de Erros:** Gerencie eficientemente erros de comunicação e respostas da API Groq, capturando exceções específicas e fornecendo mensagens informativas.
13-
- **Configuração Flexível:** Defina várias instâncias da API Groq, personalize timeouts de requisição, configure opções de cache e ajuste o comportamento do pacote conforme suas necessidades.
14-
- **Exemplos Práticos Detalhados:** Explore exemplos de código que demonstram como usar o pacote Groq Laravel em cenários reais, incluindo chatbots, transcrição de áudio e muito mais.
15-
- **Testes Abrangentes:** Garanta a qualidade e confiabilidade do pacote com um conjunto de testes que cobrem aspectos de integração, testes unitários e configuração.
11+
- **Simple and Intuitive Interface:** Interact with the Groq API using the `Groq` facade, simplifying access to chat, translation, audio transcription, function call, and image analysis functionalities.
12+
- **Robust Error Handling:** Efficiently manage communication errors and responses from the Groq API, capturing specific exceptions and providing informative messages.
13+
- **Flexible Configuration:** Define multiple Groq API instances, customize request timeouts, configure caching options, and adjust the package's behavior to suit your needs.
14+
- **Detailed Practical Examples:** Explore code examples that demonstrate how to use the Groq Laravel package in real-world scenarios, including chatbots, audio transcription, and more.
15+
- **Comprehensive Testing:** Ensure the quality and reliability of the package with a suite of tests covering integration, unit testing, and configuration.
1616

17-
## Instalação
17+
## Installation
1818

19-
1. Instale o pacote via Composer:
19+
1. Install the package via Composer:
2020

2121
```bash
2222
composer require lucianotonet/groq-laravel
2323
```
2424

25-
2. Publique o arquivo de configuração:
25+
2. Publish the configuration file:
2626

2727
```bash
2828
php artisan vendor:publish --provider="LucianoTonet\GroqLaravel\GroqServiceProvider"
2929
```
3030

31-
3. Configure suas credenciais da API Groq no arquivo `.env`:
31+
3. Configure your Groq API credentials in the `.env` file:
3232

3333
```
3434
GROQ_API_KEY=your_api_key_here
3535
GROQ_API_BASE=https://api.groq.com/openai/v1
3636
```
3737

38-
4. (Opcional) Configure o cache definindo as seguintes variáveis de ambiente no arquivo `.env`:
38+
4. (Optional) Configure caching by setting the following environment variables in the `.env` file:
3939

4040
```
4141
GROQ_CACHE_DRIVER=file
4242
GROQ_CACHE_TTL=3600
4343
```
4444

45-
5. Importe a facade `Groq` em suas classes:
45+
5. Import the `Groq` facade into your classes:
4646

4747
```php
4848
use LucianoTonet\GroqLaravel\Facades\Groq;
4949
```
5050

51-
## Uso
51+
## Usage
5252

53-
Aqui está um exemplo simples de como criar uma conclusão de chat:
53+
Here is a simple example of how to create a chat completion:
5454

5555
```php
5656
$response = Groq::chat()->completions()->create([
5757
'model' => 'llama-3.1-8b-instant',
5858
'messages' => [
59-
['role' => 'user', 'content' => 'Olá, como você está?'],
59+
['role' => 'user', 'content' => 'Hello, how are you?'],
6060
],
6161
]);
6262
```
6363

64-
## Tratamento de Erros
64+
## Error Handling
6565

66-
O pacote Groq Laravel facilita o tratamento de erros que podem ocorrer ao interagir com a API Groq. Use um bloco `try-catch` para capturar e gerenciar exceções:
66+
The Groq Laravel package makes it easy to handle errors that may occur when interacting with the Groq API. Use a `try-catch` block to capture and manage exceptions:
6767

6868
```php
6969
try {
@@ -72,37 +72,79 @@ try {
7272
// ...
7373
]);
7474
} catch (GroqException $e) {
75-
Log::error('Erro na API Groq: ' . $e->getMessage());
76-
abort(500, 'Erro ao processar sua solicitação.');
75+
Log::error('Error in Groq API: ' . $e->getMessage());
76+
abort(500, 'Error processing your request.');
7777
}
7878
```
7979

80-
## Testes
80+
## Vision API
8181

82-
Os testes são uma parte essencial do desenvolvimento de software de qualidade. O pacote Groq Laravel inclui uma suíte de testes que cobre integração, unidade e configuração. Para executar os testes, siga os passos abaixo:
82+
The Groq Laravel package also provides access to the Groq Vision API, allowing you to analyze images and extract information from them.
8383

84-
1. **Instale as dependências do projeto:**
84+
**Example of use with image URL:**
85+
86+
```php
87+
use LucianoTonet\GroqLaravel\Facades\Groq;
88+
89+
// ...
90+
91+
$imageUrl = 'https://example.com/image.jpg'; // Replace with your image URL
92+
$prompt = 'Describe the image';
93+
94+
$response = Groq::vision()->analyze($imageUrl, $prompt);
95+
96+
$imageDescription = $response['choices'][0]['message']['content'];
97+
98+
// ... do something with the image description
99+
```
100+
101+
**Example of use with local image file:**
102+
103+
```php
104+
use LucianoTonet\GroqLaravel\Facades\Groq;
105+
106+
// ...
107+
108+
$imagePath = '/path/to/your/image.jpg'; // Replace with the actual path
109+
$prompt = 'What do you see in this image?';
110+
111+
$response = Groq::vision()->analyze($imagePath, $prompt);
112+
113+
$imageAnalysis = $response['choices'][0]['message']['content'];
114+
115+
// ... do something with the image analysis
116+
```
117+
118+
**Remember:**
119+
- The Vision API requires a model compatible with image analysis, such as `llava-v1.5-7b-4096-preview`. You can configure the default model for Vision in the `config/groq.php` configuration file.
120+
- The Vision API is an experimental feature and may not meet expectations, as well as not having long-term support.
121+
122+
## Testing
123+
124+
Testing is an essential part of quality software development. The Groq Laravel package includes a test suite that covers integration, unit, and configuration. To run the tests, follow the steps below:
125+
126+
1. **Install the project dependencies:**
85127

86128
```bash
87129
composer install
88130
```
89131

90-
2. **Execute os testes:**
132+
2. **Run the tests:**
91133

92134
```bash
93135
vendor/bin/phpunit ./tests/Feature
94136
```
95137

96-
ou individualmente:
138+
or individually:
97139

98140
```bash
99141
vendor/bin/phpunit ./tests/Feature/FacadeTest.php
100142
```
101143

102-
## Contribuindo
144+
## Contributing
103145

104-
Contribuições são bem-vindas! Siga as diretrizes descritas no arquivo [CONTRIBUTING.md](CONTRIBUTING.md).
146+
Contributions are welcome! Follow the guidelines described in the [CONTRIBUTING.md](CONTRIBUTING.md) file.
105147

106-
## Licença
148+
## License
107149

108-
Este pacote é um software de código aberto licenciado sob a [licença MIT](LICENSE).
150+
This package is open-source software licensed under the [MIT license](LICENSE).

0 commit comments

Comments
 (0)