We do this on sendMessage:
$config = (new GenerationConfig())
->withCandidateCount(1);
$response = $this->model
->withGenerationConfig($config)
->generateContentWithContents($this->history);
Which overwrittes any previously defined generation config.