@@ -48,7 +48,6 @@ public function testItDoesNothingWithoutRawResponse()
48
48
49
49
public function testItAddsUsageTokensToMetadata ()
50
50
{
51
- // Arrange
52
51
$ textResult = new TextResult ('test ' );
53
52
54
53
$ rawResponse = $ this ->createRawResponse ([
@@ -64,10 +63,8 @@ public function testItAddsUsageTokensToMetadata()
64
63
$ processor = new TokenOutputProcessor ();
65
64
$ output = $ this ->createOutput ($ textResult );
66
65
67
- // Act
68
66
$ processor ->processOutput ($ output );
69
67
70
- // Assert
71
68
$ metadata = $ output ->result ->getMetadata ();
72
69
$ tokenUsage = $ metadata ->get ('token_usage ' );
73
70
@@ -81,7 +78,6 @@ public function testItAddsUsageTokensToMetadata()
81
78
82
79
public function testItHandlesMissingUsageFields ()
83
80
{
84
- // Arrange
85
81
$ textResult = new TextResult ('test ' );
86
82
87
83
$ rawResponse = $ this ->createRawResponse ([
@@ -94,10 +90,8 @@ public function testItHandlesMissingUsageFields()
94
90
$ processor = new TokenOutputProcessor ();
95
91
$ output = $ this ->createOutput ($ textResult );
96
92
97
- // Act
98
93
$ processor ->processOutput ($ output );
99
94
100
- // Assert
101
95
$ metadata = $ output ->result ->getMetadata ();
102
96
$ tokenUsage = $ metadata ->get ('token_usage ' );
103
97
@@ -111,17 +105,14 @@ public function testItHandlesMissingUsageFields()
111
105
112
106
public function testItAddsEmptyTokenUsageWhenUsageMetadataNotPresent ()
113
107
{
114
- // Arrange
115
108
$ textResult = new TextResult ('test ' );
116
109
$ rawResponse = $ this ->createRawResponse (['other ' => 'data ' ]);
117
110
$ textResult ->setRawResult ($ rawResponse );
118
111
$ processor = new TokenOutputProcessor ();
119
112
$ output = $ this ->createOutput ($ textResult );
120
113
121
- // Act
122
114
$ processor ->processOutput ($ output );
123
115
124
- // Assert
125
116
$ metadata = $ output ->result ->getMetadata ();
126
117
$ tokenUsage = $ metadata ->get ('token_usage ' );
127
118
0 commit comments