This repository was archived by the owner on Jul 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +71
-11
lines changed Expand file tree Collapse file tree 10 files changed +71
-11
lines changed Original file line number Diff line number Diff line change 5
5
namespace PhpLlm \LlmChain \Platform \Message ;
6
6
7
7
use PhpLlm \LlmChain \Platform \Response \ToolCall ;
8
+ use Symfony \Component \Uid \AbstractUid ;
9
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
8
10
use Symfony \Component \Uid \Uuid ;
9
11
10
12
/**
11
13
* @author Denis Zunke <[email protected] >
12
14
*/
13
15
final readonly class AssistantMessage implements MessageInterface
14
16
{
15
- public Uuid $ id ;
17
+ public AbstractUid & TimeBasedUidInterface $ id ;
16
18
17
19
/**
18
20
* @param ?ToolCall[] $toolCalls
@@ -29,7 +31,7 @@ public function getRole(): Role
29
31
return Role::Assistant;
30
32
}
31
33
32
- public function getId (): Uuid
34
+ public function getId (): AbstractUid & TimeBasedUidInterface
33
35
{
34
36
return $ this ->id ;
35
37
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace PhpLlm \LlmChain \Platform \Message ;
6
6
7
- use Symfony \Component \Uid \Uuid ;
7
+ use Symfony \Component \Uid \AbstractUid ;
8
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
8
9
9
10
/**
10
11
* @author Denis Zunke <[email protected] >
@@ -13,5 +14,5 @@ interface MessageInterface
13
14
{
14
15
public function getRole (): Role ;
15
16
16
- public function getId (): Uuid ;
17
+ public function getId (): AbstractUid & TimeBasedUidInterface ;
17
18
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace PhpLlm \LlmChain \Platform \Message ;
6
6
7
+ use Symfony \Component \Uid \AbstractUid ;
8
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
7
9
use Symfony \Component \Uid \Uuid ;
8
10
9
11
/**
10
12
* @author Denis Zunke <[email protected] >
11
13
*/
12
14
final readonly class SystemMessage implements MessageInterface
13
15
{
14
- public Uuid $ id ;
16
+ public AbstractUid & TimeBasedUidInterface $ id ;
15
17
16
18
public function __construct (public string $ content )
17
19
{
@@ -23,7 +25,7 @@ public function getRole(): Role
23
25
return Role::System;
24
26
}
25
27
26
- public function getId (): Uuid
28
+ public function getId (): AbstractUid & TimeBasedUidInterface
27
29
{
28
30
return $ this ->id ;
29
31
}
Original file line number Diff line number Diff line change 5
5
namespace PhpLlm \LlmChain \Platform \Message ;
6
6
7
7
use PhpLlm \LlmChain \Platform \Response \ToolCall ;
8
+ use Symfony \Component \Uid \AbstractUid ;
9
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
8
10
use Symfony \Component \Uid \Uuid ;
9
11
10
12
/**
11
13
* @author Denis Zunke <[email protected] >
12
14
*/
13
15
final readonly class ToolCallMessage implements MessageInterface
14
16
{
15
- public Uuid $ id ;
17
+ public AbstractUid & TimeBasedUidInterface $ id ;
16
18
17
19
public function __construct (
18
20
public ToolCall $ toolCall ,
@@ -26,7 +28,7 @@ public function getRole(): Role
26
28
return Role::ToolCall;
27
29
}
28
30
29
- public function getId (): Uuid
31
+ public function getId (): AbstractUid & TimeBasedUidInterface
30
32
{
31
33
return $ this ->id ;
32
34
}
Original file line number Diff line number Diff line change 8
8
use PhpLlm \LlmChain \Platform \Message \Content \ContentInterface ;
9
9
use PhpLlm \LlmChain \Platform \Message \Content \Image ;
10
10
use PhpLlm \LlmChain \Platform \Message \Content \ImageUrl ;
11
+ use Symfony \Component \Uid \AbstractUid ;
12
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
11
13
use Symfony \Component \Uid \Uuid ;
12
14
13
15
/**
20
22
*/
21
23
public array $ content ;
22
24
23
- public Uuid $ id ;
25
+ public AbstractUid & TimeBasedUidInterface $ id ;
24
26
25
27
public function __construct (
26
28
ContentInterface ...$ content ,
@@ -34,7 +36,7 @@ public function getRole(): Role
34
36
return Role::User;
35
37
}
36
38
37
- public function getId (): Uuid
39
+ public function getId (): AbstractUid & TimeBasedUidInterface
38
40
{
39
41
return $ this ->id ;
40
42
}
Original file line number Diff line number Diff line change 35
35
use PHPUnit \Framework \Attributes \Test ;
36
36
use PHPUnit \Framework \Attributes \UsesClass ;
37
37
use PHPUnit \Framework \TestCase ;
38
+ use Symfony \Component \Uid \AbstractUid ;
39
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
38
40
use Symfony \Component \Uid \Uuid ;
39
41
40
42
#[Large]
@@ -201,7 +203,7 @@ public function getRole(): Role
201
203
return Role::User;
202
204
}
203
205
204
- public function getId (): Uuid
206
+ public function getId (): AbstractUid & TimeBasedUidInterface
205
207
{
206
208
return Uuid::v7 ();
207
209
}
Original file line number Diff line number Diff line change 13
13
use PHPUnit \Framework \Attributes \Test ;
14
14
use PHPUnit \Framework \Attributes \UsesClass ;
15
15
use PHPUnit \Framework \TestCase ;
16
+ use Symfony \Component \Uid \AbstractUid ;
17
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
16
18
use Symfony \Component \Uid \UuidV7 ;
17
19
18
20
#[CoversClass(AssistantMessage::class)]
@@ -79,4 +81,14 @@ public function sameMessagesHaveDifferentUids(): void
79
81
self ::assertIsUuidV7 ($ message1 ->getId ()->toRfc4122 ());
80
82
self ::assertIsUuidV7 ($ message2 ->getId ()->toRfc4122 ());
81
83
}
84
+
85
+ #[Test]
86
+ public function messageIdImplementsRequiredInterfaces (): void
87
+ {
88
+ $ message = new AssistantMessage ('test ' );
89
+
90
+ self ::assertInstanceOf (AbstractUid::class, $ message ->getId ());
91
+ self ::assertInstanceOf (TimeBasedUidInterface::class, $ message ->getId ());
92
+ self ::assertInstanceOf (UuidV7::class, $ message ->getId ());
93
+ }
82
94
}
Original file line number Diff line number Diff line change 11
11
use PHPUnit \Framework \Attributes \Small ;
12
12
use PHPUnit \Framework \Attributes \Test ;
13
13
use PHPUnit \Framework \TestCase ;
14
+ use Symfony \Component \Uid \AbstractUid ;
15
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
14
16
use Symfony \Component \Uid \UuidV7 ;
15
17
16
18
#[CoversClass(SystemMessage::class)]
@@ -59,4 +61,14 @@ public function sameMessagesHaveDifferentUids(): void
59
61
self ::assertIsUuidV7 ($ message1 ->getId ()->toRfc4122 ());
60
62
self ::assertIsUuidV7 ($ message2 ->getId ()->toRfc4122 ());
61
63
}
64
+
65
+ #[Test]
66
+ public function messageIdImplementsRequiredInterfaces (): void
67
+ {
68
+ $ message = new SystemMessage ('test ' );
69
+
70
+ self ::assertInstanceOf (AbstractUid::class, $ message ->getId ());
71
+ self ::assertInstanceOf (TimeBasedUidInterface::class, $ message ->getId ());
72
+ self ::assertInstanceOf (UuidV7::class, $ message ->getId ());
73
+ }
62
74
}
Original file line number Diff line number Diff line change 12
12
use PHPUnit \Framework \Attributes \Test ;
13
13
use PHPUnit \Framework \Attributes \UsesClass ;
14
14
use PHPUnit \Framework \TestCase ;
15
+ use Symfony \Component \Uid \AbstractUid ;
16
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
15
17
use Symfony \Component \Uid \UuidV7 ;
16
18
17
19
#[CoversClass(ToolCallMessage::class)]
@@ -65,4 +67,15 @@ public function sameMessagesHaveDifferentUids(): void
65
67
self ::assertIsUuidV7 ($ message1 ->getId ()->toRfc4122 ());
66
68
self ::assertIsUuidV7 ($ message2 ->getId ()->toRfc4122 ());
67
69
}
70
+
71
+ #[Test]
72
+ public function messageIdImplementsRequiredInterfaces (): void
73
+ {
74
+ $ toolCall = new ToolCall ('foo ' , 'bar ' );
75
+ $ message = new ToolCallMessage ($ toolCall , 'test ' );
76
+
77
+ self ::assertInstanceOf (AbstractUid::class, $ message ->getId ());
78
+ self ::assertInstanceOf (TimeBasedUidInterface::class, $ message ->getId ());
79
+ self ::assertInstanceOf (UuidV7::class, $ message ->getId ());
80
+ }
68
81
}
Original file line number Diff line number Diff line change 15
15
use PHPUnit \Framework \Attributes \Test ;
16
16
use PHPUnit \Framework \Attributes \UsesClass ;
17
17
use PHPUnit \Framework \TestCase ;
18
+ use Symfony \Component \Uid \AbstractUid ;
19
+ use Symfony \Component \Uid \TimeBasedUidInterface ;
18
20
use Symfony \Component \Uid \UuidV7 ;
19
21
20
22
#[CoversClass(UserMessage::class)]
@@ -109,4 +111,14 @@ public function sameMessagesHaveDifferentUids(): void
109
111
self ::assertIsUuidV7 ($ message1 ->getId ()->toRfc4122 ());
110
112
self ::assertIsUuidV7 ($ message2 ->getId ()->toRfc4122 ());
111
113
}
114
+
115
+ #[Test]
116
+ public function messageIdImplementsRequiredInterfaces (): void
117
+ {
118
+ $ message = new UserMessage (new Text ('test ' ));
119
+
120
+ self ::assertInstanceOf (AbstractUid::class, $ message ->getId ());
121
+ self ::assertInstanceOf (TimeBasedUidInterface::class, $ message ->getId ());
122
+ self ::assertInstanceOf (UuidV7::class, $ message ->getId ());
123
+ }
112
124
}
You can’t perform that action at this time.
0 commit comments