From 9936f65cd3f47ec723ee94723a2a3dc51523ee23 Mon Sep 17 00:00:00 2001 From: Umesh Yadav Date: Tue, 26 Aug 2025 15:51:45 +0530 Subject: [PATCH] Move OLLAMA_API_KEY_VAR to ollama crate Co-authored-by: Oliver Azevedo Barnes --- crates/language_models/src/provider/ollama.rs | 6 +++--- crates/ollama/src/ollama.rs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/language_models/src/provider/ollama.rs b/crates/language_models/src/provider/ollama.rs index d500524e08..b8b55e252e 100644 --- a/crates/language_models/src/provider/ollama.rs +++ b/crates/language_models/src/provider/ollama.rs @@ -14,8 +14,9 @@ use language_model::{ }; use menu; use ollama::{ - ChatMessage, ChatOptions, ChatRequest, ChatResponseDelta, KeepAlive, OLLAMA_API_URL, - OllamaFunctionTool, OllamaToolCall, get_models, show_model, stream_chat_completion, + ChatMessage, ChatOptions, ChatRequest, ChatResponseDelta, KeepAlive, OLLAMA_API_KEY_VAR, + OLLAMA_API_URL, OllamaFunctionTool, OllamaToolCall, get_models, show_model, + stream_chat_completion, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -33,7 +34,6 @@ use crate::ui::InstructionListItem; const OLLAMA_DOWNLOAD_URL: &str = "https://ollama.com/download"; const OLLAMA_LIBRARY_URL: &str = "https://ollama.com/library"; const OLLAMA_SITE: &str = "https://ollama.com/"; -const OLLAMA_API_KEY_VAR: &str = "OLLAMA_API_KEY"; const PROVIDER_ID: LanguageModelProviderId = LanguageModelProviderId::new("ollama"); const PROVIDER_NAME: LanguageModelProviderName = LanguageModelProviderName::new("Ollama"); diff --git a/crates/ollama/src/ollama.rs b/crates/ollama/src/ollama.rs index f45f3f6f6f..6d17c7c4d7 100644 --- a/crates/ollama/src/ollama.rs +++ b/crates/ollama/src/ollama.rs @@ -6,6 +6,7 @@ use serde_json::Value; use std::time::Duration; pub const OLLAMA_API_URL: &str = "http://localhost:11434"; +pub const OLLAMA_API_KEY_VAR: &str = "OLLAMA_API_KEY"; #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq)]