Skip to content

Commit

Permalink
Merge pull request #12 from Jamonek/main
Browse files Browse the repository at this point in the history
Add keep alive support
  • Loading branch information
cloudstudio authored May 1, 2024
2 parents f38ca92 + 9691a63 commit 977f01e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Ollama.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ class Ollama
*/
protected $image = null;

/**
* keep alive
*
* @ var mixed
*/
protected $keepAlive = "5m";

/**
* Ollama class constructor.
*/
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -279,6 +298,7 @@ public function ask()
'options' => $this->options,
'stream' => $this->stream,
'raw' => $this->raw,
'keep_alive'=> $this->keepAlive,
];

if ($this->image) {
Expand Down

0 comments on commit 977f01e

Please sign in to comment.