branch: externals/ellama
commit 97f591c478571c4d2997d2466119720cd671785c
Author: Sergey Kostyaev <sskosty...@gmail.com>
Commit: Sergey Kostyaev <sskosty...@gmail.com>

    Move require and declare for llm-ollama
    
    Moved (require 'llm-ollama) from inside the function to top scope to ensure
    package is loaded before use. Added (declare-function make-llm-ollama
    "ext:llm-ollama") to properly declare external function reference.
    
    Relates to #319 and #313
---
 ellama.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ellama.el b/ellama.el
index 5ba23084e0..3dff72b51c 100644
--- a/ellama.el
+++ b/ellama.el
@@ -2372,6 +2372,7 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
      (lambda (err)
        (user-error err)))))
 
+(declare-function make-llm-ollama "ext:llm-ollama")
 (defun ellama-get-ollama-model-names ()
   "Get ollama model names."
   (llm-models (or ellama-provider
@@ -2411,12 +2412,12 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
   (declare-function llm-ollama-p "ext:llm-ollama")
   (declare-function llm-ollama-host "ext:llm-ollama")
   (declare-function llm-ollama-port "ext:llm-ollama")
+  (require 'llm-ollama)
   (let ((model-name (ellama-get-ollama-model-name))
        (host (when (llm-ollama-p ellama-provider)
                (llm-ollama-host ellama-provider)))
        (port (when (llm-ollama-p ellama-provider)
                (llm-ollama-port ellama-provider))))
-    (require 'llm-ollama)
     (if host
        (make-llm-ollama
         :chat-model model-name :embedding-model model-name :host host :port 
port)

Reply via email to