From 9691a633c392c6a0e202c7050c48bfade7e07e30 Mon Sep 17 00:00:00 2001 From: Jamone Kelly Date: Sun, 21 Apr 2024 15:37:35 -0400 Subject: [PATCH] Add keep alive support --- src/Ollama.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Ollama.php b/src/Ollama.php index e306d1b..e79a043 100755 --- a/src/Ollama.php +++ b/src/Ollama.php @@ -83,6 +83,13 @@ class Ollama */ protected $image = null; + /** + * keep alive + * + * @ var mixed + */ + protected $keepAlive = "5m"; + /** * Ollama class constructor. */ @@ -177,6 +184,18 @@ public function raw(bool $raw) return $this; } + /** + * Controls how long the model will stay loaded into memory following the request + * + * @param string $keepAlive + * @return $this + */ + public function keepAlive(string $keepAlive) + { + $this->keepAlive = $keepAlive; + return $this; + } + /** * Lists available local models. * @@ -279,6 +298,7 @@ public function ask() 'options' => $this->options, 'stream' => $this->stream, 'raw' => $this->raw, + 'keep_alive'=> $this->keepAlive, ]; if ($this->image) {