Skip to content

Commit 6eea4db

Browse files
committed
chore: add support for vision models
1 parent 68219a7 commit 6eea4db

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/Services/GrokVision.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace GrokPHP\Laravel\Services;
4+
5+
use GrokPHP\Client\Clients\GrokClient;
6+
use GrokPHP\Client\Enums\Model;
7+
use GrokPHP\Client\Exceptions\GrokException;
8+
use GrokPHP\Laravel\Support\GrokResponse;
9+
10+
class GrokVision
11+
{
12+
protected GrokClient $client;
13+
14+
public function __construct(GrokClient $client)
15+
{
16+
$this->client = $client;
17+
}
18+
19+
/**
20+
* Analyze an image using Grok Vision models.
21+
* @throws GrokException
22+
*/
23+
public function analyze(string $imagePath, string $prompt, ?Model $model = null): GrokResponse
24+
{
25+
$response = $this->client->vision()->analyze($imagePath, $prompt, $model);
26+
27+
return new GrokResponse($response);
28+
}
29+
}

0 commit comments

Comments
 (0)