Skip to content

Commit ead080b

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents df45cad + e5d46d8 commit ead080b

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/Clients/GrokClient.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ public function setHttpClient(Client $client): void
5353
/**
5454
* Sends a chat request to Grok API.
5555
*
56-
* @param array $messages Chat messages
57-
* @param ChatOptions $options Chat configuration
56+
* @param array $messages Chat messages
57+
* @param ChatOptions $options Chat configuration
5858
* @return array API response
59+
*
5960
* @throws GrokException
6061
*/
6162
public function chat(array $messages, ChatOptions $options): array

src/Config/GrokConfig.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(
2020
) {
2121
$this->apiKey = $apiKey ?? getenv('GROK_API_KEY');
2222

23-
if(! $this->apiKey) {
23+
if (! $this->apiKey) {
2424
throw GrokException::missingApiKey();
2525
}
2626
$this->timeout = (int) DefaultConfig::TIMEOUT->value;

src/Exceptions/GrokException.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function getResponseBody(): ?stdClass
7171

7272
/**
7373
* Convert the exception details to an array.
74+
*
7475
* @throws JsonException
7576
*/
7677
public function toArray(): array
@@ -86,6 +87,7 @@ public function toArray(): array
8687

8788
/**
8889
* Convert the exception details to JSON.
90+
*
8991
* @throws JsonException
9092
*/
9193
public function toJson(): string
@@ -95,6 +97,7 @@ public function toJson(): string
9597

9698
/**
9799
* Create a `GrokException` from an API response.
100+
*
98101
* @throws JsonException
99102
*/
100103
public static function fromResponse(ResponseInterface $response): self
@@ -125,6 +128,7 @@ public static function fromResponse(ResponseInterface $response): self
125128

126129
/**
127130
* Handle exceptions from Guzzle.
131+
*
128132
* @throws JsonException
129133
*/
130134
public static function fromGuzzleException(ClientException $exception): self
@@ -138,7 +142,7 @@ public static function fromGuzzleException(ClientException $exception): self
138142
public static function missingApiKey(): self
139143
{
140144
return new self(
141-
"No API key provided. Specify your API key in an Authorization header using Bearer auth.",
145+
'No API key provided. Specify your API key in an Authorization header using Bearer auth.',
142146
400,
143147
'authentication_error'
144148
);
@@ -150,7 +154,7 @@ public static function missingApiKey(): self
150154
public static function invalidApiKey(): self
151155
{
152156
return new self(
153-
"Incorrect API key provided. Obtain an API key from https://console.x.ai.",
157+
'Incorrect API key provided. Obtain an API key from https://console.x.ai.',
154158
400,
155159
'invalid_api_key'
156160
);
@@ -162,7 +166,7 @@ public static function invalidApiKey(): self
162166
public static function invalidRequest(): self
163167
{
164168
return new self(
165-
"Failed to deserialize the JSON body into the target type. Ensure request structure is correct.",
169+
'Failed to deserialize the JSON body into the target type. Ensure request structure is correct.',
166170
422,
167171
'invalid_request'
168172
);

0 commit comments

Comments
 (0)