From 0e5dbd09e198a4ea09764ef8af8e08dbdafb91b0 Mon Sep 17 00:00:00 2001 From: murilo Date: Mon, 10 Feb 2025 07:10:58 -0400 Subject: [PATCH] Do not overwrite GenerationConfig on ChatSession --- src/ChatSession.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/ChatSession.php b/src/ChatSession.php index 34f3ae6..b7bb71b 100644 --- a/src/ChatSession.php +++ b/src/ChatSession.php @@ -31,11 +31,7 @@ public function sendMessage(PartInterface ...$parts): GenerateContentResponse { $this->history[] = new Content($parts, Role::User); - $config = (new GenerationConfig()) - ->withCandidateCount(1); - $response = $this->model - ->withGenerationConfig($config) - ->generateContentWithContents($this->history); + $response = $this->model->generateContentWithContents($this->history); if (!empty($response->candidates)) { $parts = $response->candidates[0]->content->parts; @@ -65,11 +61,7 @@ public function sendMessageStream( $callback($response); }; - $config = (new GenerationConfig()) - ->withCandidateCount(1); - $this->model - ->withGenerationConfig($config) - ->generateContentStreamWithContents($partsCollectorCallback, $this->history); + $this->model->generateContentStreamWithContents($partsCollectorCallback, $this->history); if (!empty($parts)) { $this->history[] = new Content($parts, Role::Model);