set_prompt( $prompt ); $this->set_model( $model ); $this->set_size( $size ); } public function set_size( $size ) { if ( ! in_array( $size, self::ALLOWED_SIZES, true ) ) { throw new \InvalidArgumentException( 'Invalid size.' ); } $this->size = $size; } public function to_request_body(): array { $body = array( 'prompt' => $this->prompt, 'model' => $this->model, 'n' => $this->max_results, 'size' => $this->size, ); return $body; } }