From 53f702c92f79b30308b9c390de77e59263105011 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Fri, 14 Jun 2024 10:33:28 -0700 Subject: [PATCH] Allow Ollama Model KeepAlive to be None, defaulting to indefinite (#13059) Putting this back to `Option` to make existing configs keep working. Release Notes: - N/A --- crates/assistant/src/completion_provider/ollama.rs | 2 +- crates/ollama/src/ollama.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/assistant/src/completion_provider/ollama.rs b/crates/assistant/src/completion_provider/ollama.rs index a2d7f82554..e3a80de532 100644 --- a/crates/assistant/src/completion_provider/ollama.rs +++ b/crates/assistant/src/completion_provider/ollama.rs @@ -240,7 +240,7 @@ impl OllamaCompletionProvider { }, }) .collect(), - keep_alive: model.keep_alive, + keep_alive: model.keep_alive.unwrap_or_default(), stream: true, options: Some(ChatOptions { num_ctx: Some(model.max_tokens), diff --git a/crates/ollama/src/ollama.rs b/crates/ollama/src/ollama.rs index dbed482840..d2dfd2155d 100644 --- a/crates/ollama/src/ollama.rs +++ b/crates/ollama/src/ollama.rs @@ -66,7 +66,7 @@ impl Default for KeepAlive { pub struct Model { pub name: String, pub max_tokens: usize, - pub keep_alive: KeepAlive, + pub keep_alive: Option, } impl Model { @@ -74,7 +74,7 @@ impl Model { Self { name: name.to_owned(), max_tokens: 2048, - keep_alive: KeepAlive::indefinite(), + keep_alive: Some(KeepAlive::indefinite()), } }