Skip to content

Commit 8c35ed0

Browse files
authored
Makes imports consistent (#253)
1 parent f1cbcca commit 8c35ed0

18 files changed

+44
-27
lines changed

src/Ai.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\Facades\Facade;
66

77
/**
8-
* @see \Laravel\Ai\AiManager
8+
* @see AiManager
99
*/
1010
class Ai extends Facade
1111
{

src/Contracts/ConversationStore.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Laravel\Ai\Contracts;
44

55
use Illuminate\Support\Collection;
6+
use Laravel\Ai\Messages\Message;
67
use Laravel\Ai\Prompts\AgentPrompt;
78
use Laravel\Ai\Responses\AgentResponse;
89

@@ -31,7 +32,7 @@ public function storeAssistantMessage(string $conversationId, string|int|null $u
3132
/**
3233
* Get the latest messages for the given conversation.
3334
*
34-
* @return \Illuminate\Support\Collection<int, \Laravel\Ai\Messages\Message>
35+
* @return Collection<int, Message>
3536
*/
3637
public function getLatestConversationMessages(string $conversationId, int $limit): Collection;
3738
}

src/Contracts/Conversational.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Laravel\Ai\Contracts;
44

5+
use Laravel\Ai\Messages\Message;
6+
57
interface Conversational
68
{
79
/**
810
* Get the list of messages comprising the conversation so far.
911
*
10-
* @return \Laravel\Ai\Messages\Message[]
12+
* @return Message[]
1113
*/
1214
public function messages(): iterable;
1315
}

src/Contracts/Gateway/TextGateway.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@
44

55
use Closure;
66
use Generator;
7+
use Illuminate\JsonSchema\Types\Type;
78
use Laravel\Ai\Contracts\Providers\TextProvider;
9+
use Laravel\Ai\Contracts\Tool;
810
use Laravel\Ai\Gateway\TextGenerationOptions;
11+
use Laravel\Ai\Messages\Message;
912
use Laravel\Ai\Responses\TextResponse;
1013

1114
interface TextGateway
1215
{
1316
/**
1417
* Generate text representing the next message in a conversation.
1518
*
16-
* @param \Laravel\Ai\Messages\Message[] $messages
17-
* @param \Laravel\Ai\Contracts\Tool[] $tools
18-
* @param array<string, \Illuminate\JsonSchema\Types\Type>|null $schema
19+
* @param Message[] $messages
20+
* @param Tool[] $tools
21+
* @param array<string, Type>|null $schema
1922
*/
2023
public function generateText(
2124
TextProvider $provider,
@@ -31,9 +34,9 @@ public function generateText(
3134
/**
3235
* Stream text representing the next message in a conversation.
3336
*
34-
* @param \Laravel\Ai\Messages\Message[] $messages
35-
* @param \Laravel\Ai\Contracts\Tool[] $tools
36-
* @param array<string, \Illuminate\JsonSchema\Types\Type>|null $schema
37+
* @param Message[] $messages
38+
* @param Tool[] $tools
39+
* @param array<string, Type>|null $schema
3740
*/
3841
public function streamText(
3942
string $invocationId,

src/Contracts/HasStructuredOutput.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
namespace Laravel\Ai\Contracts;
44

55
use Illuminate\Contracts\JsonSchema\JsonSchema;
6+
use Illuminate\JsonSchema\Types\Type;
67

78
interface HasStructuredOutput
89
{
910
/**
1011
* Get the agent's structured output schema definition.
1112
*
12-
* @return array<string, \Illuminate\JsonSchema\Types\Type>
13+
* @return array<string, Type>
1314
*/
1415
public function schema(JsonSchema $schema): array;
1516
}

src/Contracts/Tool.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Laravel\Ai\Contracts;
44

55
use Illuminate\Contracts\JsonSchema\JsonSchema;
6+
use Illuminate\JsonSchema\Types\Type;
67
use Laravel\Ai\Tools\Request;
78
use Stringable;
89

@@ -21,7 +22,7 @@ public function handle(Request $request): Stringable|string;
2122
/**
2223
* Get the tool's schema definition.
2324
*
24-
* @return array<string, \Illuminate\JsonSchema\Types\Type>
25+
* @return array<string, Type>
2526
*/
2627
public function schema(JsonSchema $schema): array;
2728
}

src/Gateway/FakeTextGateway.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Closure;
66
use Generator;
77
use Illuminate\JsonSchema\Types\ObjectType;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Illuminate\Support\Collection;
910
use Illuminate\Support\Str;
1011
use Laravel\Ai\Contracts\Gateway\TextGateway;
@@ -37,7 +38,7 @@ public function __construct(
3738
/**
3839
* Generate text representing the next message in a conversation.
3940
*
40-
* @param array<string, \Illuminate\JsonSchema\Types\Type>|null $schema
41+
* @param array<string, Type>|null $schema
4142
*/
4243
public function generateText(
4344
TextProvider $provider,
@@ -61,7 +62,7 @@ public function generateText(
6162
/**
6263
* Stream text representing the next message in a conversation.
6364
*
64-
* @param array<string, \Illuminate\JsonSchema\Types\Type>|null $schema
65+
* @param array<string, Type>|null $schema
6566
*/
6667
public function streamText(
6768
string $invocationId,

src/PendingResponses/PendingImageGeneration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Laravel\Ai\Events\ProviderFailedOver;
99
use Laravel\Ai\Exceptions\FailoverableException;
1010
use Laravel\Ai\FakePendingDispatch;
11+
use Laravel\Ai\Files\Image;
1112
use Laravel\Ai\Files\LocalImage;
1213
use Laravel\Ai\Files\StoredImage;
1314
use Laravel\Ai\Jobs\GenerateImage;
@@ -36,7 +37,7 @@ public function __construct(
3637
/**
3738
* Provide the reference images that should be sent with the request.
3839
*
39-
* @param array<\Laravel\Ai\Files\Image> $attachments
40+
* @param array<Image> $attachments
4041
*/
4142
public function attachments(array $attachments): self
4243
{

src/Providers/Tools/FileSearch.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class FileSearch extends ProviderTool
1818
/**
1919
* Create a new file search tool instance.
2020
*
21-
* @param array|(\Closure(FileSearchQuery): mixed)|null $where
21+
* @param array|(Closure(FileSearchQuery): mixed)|null $where
2222
*/
2323
public function __construct(
2424
public array $stores,
@@ -43,7 +43,7 @@ public function ids(): array
4343
/**
4444
* Resolve the filters from the given value.
4545
*
46-
* @param (\Closure(FileSearchQuery): mixed)|array|null $where
46+
* @param (Closure(FileSearchQuery): mixed)|array|null $where
4747
* @return array<int, array{type: string, key: string, value: mixed}>
4848
*/
4949
protected function resolveFilters(Closure|array|null $where): array

src/Responses/Concerns/CanStreamUsingVercelProtocol.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
namespace Laravel\Ai\Responses\Concerns;
44

5+
use Illuminate\Http\Request;
56
use Laravel\Ai\Streaming\Events\StreamEnd;
67
use Laravel\Ai\Streaming\Events\StreamStart;
78
use Laravel\Ai\Streaming\Events\ToolCall;
89
use Laravel\Ai\Streaming\Events\ToolResult;
10+
use Symfony\Component\HttpFoundation\Response;
911

1012
trait CanStreamUsingVercelProtocol
1113
{
1214
/**
1315
* Create an HTTP response that represents the object using the Vercel AI SDK protocol
1416
*
15-
* @param \Illuminate\Http\Request $request
16-
* @return \Symfony\Component\HttpFoundation\Response
17+
* @param Request $request
18+
* @return Response
1719
*/
1820
protected function toVercelProtocolResponse()
1921
{

0 commit comments

Comments
 (0)