✨ ollama keep_alive

This commit is contained in:
Nate Sesti 2024-03-06 16:20:27 -08:00
parent 0b9fbeed6c
commit 2614465db7
3 changed files with 7 additions and 1 deletions

1
core/index.d.ts vendored
View file

@ -547,6 +547,7 @@ interface BaseCompletionOptions {
stop?: string[];
maxTokens?: number;
numThreads?: number;
keepAlive?: number;
}
export interface ModelDescription {

View file

@ -115,7 +115,7 @@ class Ollama extends BaseLLM {
const finalOptions: any = {
model: this._getModel(),
raw: true,
keep_alive: 60 * 30, // 30 minutes
keep_alive: options.keepAlive ?? 60 * 30, // 30 minutes
options: {
temperature: options.temperature,
top_p: options.topP,

View file

@ -54,6 +54,11 @@
"title": "Number of threads",
"description": "The number of threads used in the generation process. Only available for Ollama (this is the num_thread parameter)",
"type": "integer"
},
"keepAlive": {
"title": "Ollama keep_alive",
"description": "The number of seconds after no requests are made to unload the model from memory. Defaults to 60*30 = 30min",
"type": "integer"
}
}
},