diff --git a/src/ChatSession.php b/src/ChatSession.php index 013b9c7..34f3ae6 100644 --- a/src/ChatSession.php +++ b/src/ChatSession.php @@ -37,7 +37,7 @@ public function sendMessage(PartInterface ...$parts): GenerateContentResponse ->withGenerationConfig($config) ->generateContentWithContents($this->history); - if(!empty($response->candidates)) { + if (!empty($response->candidates)) { $parts = $response->candidates[0]->content->parts; $this->history[] = new Content($parts, Role::Model); } @@ -58,7 +58,7 @@ public function sendMessageStream( $parts = []; $partsCollectorCallback = function (GenerateContentResponse $response) use ($callback, &$parts) { - if(!empty($response->candidates)) { + if (!empty($response->candidates)) { array_push($parts, ...$response->parts()); } diff --git a/tests/Unit/ClientTest.php b/tests/Unit/ClientTest.php index 0bd11c6..0e8f25e 100644 --- a/tests/Unit/ClientTest.php +++ b/tests/Unit/ClientTest.php @@ -23,7 +23,7 @@ class ClientTest extends TestCase { - public function testConstructor() + public function testConstructor(): void { $client = new Client( 'test-api-key', @@ -32,7 +32,7 @@ public function testConstructor() self::assertInstanceOf(Client::class, $client); } - public function testWithBaseUrl() + public function testWithBaseUrl(): void { $client = new Client( 'test-api-key', @@ -42,7 +42,7 @@ public function testWithBaseUrl() self::assertInstanceOf(Client::class, $client); } - public function testGeminiPro() + public function testGeminiPro(): void { $client = new Client( 'test-api-key', @@ -53,7 +53,7 @@ public function testGeminiPro() self::assertEquals(ModelName::GEMINI_PRO, $model->modelName); } - public function testGeminiProWithEnum() + public function testGeminiProWithEnum(): void { $client = new Client( 'test-api-key', @@ -75,7 +75,7 @@ public function testGenerativeModel() self::assertEquals(ModelName::EMBEDDING_001, $model->modelName); } - public function testGenerateContent() + public function testGenerateContent(): void { $httpRequest = new Request( 'POST', @@ -152,7 +152,7 @@ public function testGenerateContent() self::assertEquals('This is the Gemini Pro response', $response->text()); } - public function testEmbedContent() + public function testEmbedContent(): void { $httpRequest = new Request( 'POST', @@ -207,7 +207,7 @@ public function testEmbedContent() self::assertEquals([0.041395925, -0.017692696], $response->embedding->values); } - public function testCountTokens() + public function testCountTokens(): void { $httpRequest = new Request( 'POST', @@ -257,7 +257,7 @@ public function testCountTokens() self::assertEquals(10, $response->totalTokens); } - public function testListModels() + public function testListModels(): void { $httpRequest = new Request( 'GET',