branch: externals/ellama
commit 3b8cb569409ccbef7e9e955aefcd550c4be3e607
Merge: bb0bdc2f8f 84abd87b73
Author: Sergey Kostyaev <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #312 from s-kostyaev/eliminate-ollama-binary-dependency
Remove `ellama-ollama-binary` configuration
---
NEWS.org | 2 ++
README.org | 3 +--
ellama.el | 39 +++++++++++---------------------------
ellama.info | 53 ++++++++++++++++++++++++++--------------------------
tests/test-ellama.el | 2 ++
5 files changed, 42 insertions(+), 57 deletions(-)
diff --git a/NEWS.org b/NEWS.org
index 668491c5b8..2d10cfb1ba 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,5 @@
+* Version 1.8.1
+- Use direct interfacing with Ollama's API instead of local installation.
* Version 1.8.0
- Added ~create-session~ optional parameter to ~ellama-ask-about~,
~ellama-ask-selection~, ~ellama-ask-line~, and ~ellama-code-review~ commands,
diff --git a/README.org b/README.org
index eed1ffa995..d4f84f8212 100644
--- a/README.org
+++ b/README.org
@@ -288,8 +288,7 @@ There are many supported providers: ~ollama~, ~open ai~,
~vertex~,
name as key.
- ~ellama-spinner-enabled~: Enable spinner during text generation.
- ~ellama-spinner-type~: Spinner type for ellama. Default type is
-~progress-bar~.
-- ~ellama-ollama-binary~: Path to ollama binary.
+ ~progress-bar~.
- ~ellama-auto-scroll~: If enabled ellama buffer will scroll
automatically during generation. Disabled by default.
- ~ellama-fill-paragraphs~: Option to customize ellama paragraphs
diff --git a/ellama.el b/ellama.el
index 2c732d26cf..bc1e02d18e 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
;; URL: http://github.com/s-kostyaev/ellama
;; Keywords: help local tools
;; Package-Requires: ((emacs "28.1") (llm "0.24.0") (plz "0.8") (transient
"0.7") (compat "29.1"))
-;; Version: 1.8.0
+;; Version: 1.8.1
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Created: 8th Oct 2023
@@ -192,10 +192,6 @@ Make reasoning models more useful for many cases."
(when value
(ellama-setup-keymap))))
-(defcustom ellama-ollama-binary "ollama"
- "Path to ollama binary."
- :type 'string)
-
(defcustom ellama-auto-scroll nil
"If enabled ellama buffer will scroll automatically during generation."
:type 'boolean)
@@ -1681,12 +1677,9 @@ ARGS contains keys for fine control.
:on-done ON-DONE -- ON-DONE a function that's called with
the full response text when the request completes (with BUFFER current)."
(interactive "sAsk ellama: ")
- (let* ((ollama-binary (executable-find ellama-ollama-binary))
- (providers (append
+ (let* ((providers (append
`(("default model" . ellama-provider)
- ,(if (and ollama-binary
- (file-exists-p ollama-binary))
- '("ollama model" .
(ellama-get-ollama-local-model))))
+ ("ollama model" . (ellama-get-ollama-local-model)))
ellama-providers))
(variants (mapcar #'car providers))
(system (plist-get args :system))
@@ -2363,14 +2356,8 @@ Call CALLBACK on result list of strings. ARGS contains
keys for fine control.
(defun ellama-get-ollama-model-names ()
"Get ollama model names."
- (mapcar (lambda (s)
- (car (split-string s)))
- (seq-drop
- (process-lines
- (executable-find ellama-ollama-binary)
- "ls")
- ;; skip header line
- 1)))
+ (llm-models (or ellama-provider
+ (make-llm-ollama))))
(defun ellama-embedding-model-p (name)
"Check if NAME is an embedding model."
@@ -2388,11 +2375,10 @@ Call CALLBACK on result list of strings. ARGS contains
keys for fine control.
(defun ellama-get-first-ollama-chat-model ()
"Get first available ollama model."
(declare-function make-llm-ollama "ext:llm-ollama")
- (when (executable-find ellama-ollama-binary)
- (require 'llm-ollama)
- (make-llm-ollama
- :chat-model
- (car (ellama-get-ollama-chat-model-names)))))
+ (require 'llm-ollama)
+ (make-llm-ollama
+ :chat-model
+ (car (ellama-get-ollama-chat-model-names))))
(defun ellama-get-ollama-model-name ()
"Get ollama model name from installed locally."
@@ -2423,12 +2409,9 @@ Call CALLBACK on result list of strings. ARGS contains
keys for fine control.
(defun ellama-provider-select ()
"Select ellama provider."
(interactive)
- (let* ((ollama-binary (executable-find ellama-ollama-binary))
- (providers (append
+ (let* ((providers (append
`(("default model" . ellama-provider)
- ,(if (and ollama-binary
- (file-exists-p ollama-binary))
- '("ollama model" .
(ellama-get-ollama-local-model))))
+ ("ollama model" . (ellama-get-ollama-local-model)))
ellama-providers))
(variants (mapcar #'car providers)))
(setq ellama-provider
diff --git a/ellama.info b/ellama.info
index 9a305ef574..fa91e3586d 100644
--- a/ellama.info
+++ b/ellama.info
@@ -399,8 +399,7 @@ There are many supported providers: ‘ollama’, ‘open ai’,
‘vertex’,
name as key.
• ‘ellama-spinner-enabled’: Enable spinner during text generation.
• ‘ellama-spinner-type’: Spinner type for ellama. Default type is
-‘progress-bar’.
- • ‘ellama-ollama-binary’: Path to ollama binary.
+ ‘progress-bar’.
• ‘ellama-auto-scroll’: If enabled ellama buffer will scroll
automatically during generation. Disabled by default.
• ‘ellama-fill-paragraphs’: Option to customize ellama paragraphs
@@ -1416,31 +1415,31 @@ Node: Installation3613
Node: Commands8621
Node: Keymap14965
Node: Configuration17798
-Node: Context Management23139
-Node: Transient Menus for Context Management24047
-Node: Managing the Context25661
-Node: Considerations26436
-Node: Minor modes27029
-Node: ellama-context-header-line-mode29017
-Node: ellama-context-header-line-global-mode29842
-Node: ellama-context-mode-line-mode30562
-Node: ellama-context-mode-line-global-mode31410
-Node: Ellama Session Header Line Mode32114
-Node: Enabling and Disabling32683
-Node: Customization33130
-Node: Ellama Session Mode Line Mode33418
-Node: Enabling and Disabling (1)34003
-Node: Customization (1)34450
-Node: Using Blueprints34744
-Node: Key Components of Ellama Blueprints35363
-Node: Creating and Managing Blueprints35970
-Node: Variable Management36951
-Node: Keymap and Mode37420
-Node: Transient Menus38356
-Node: Running Blueprints programmatically38902
-Node: Acknowledgments39489
-Node: Contributions40202
-Node: GNU Free Documentation License40586
+Node: Context Management23086
+Node: Transient Menus for Context Management23994
+Node: Managing the Context25608
+Node: Considerations26383
+Node: Minor modes26976
+Node: ellama-context-header-line-mode28964
+Node: ellama-context-header-line-global-mode29789
+Node: ellama-context-mode-line-mode30509
+Node: ellama-context-mode-line-global-mode31357
+Node: Ellama Session Header Line Mode32061
+Node: Enabling and Disabling32630
+Node: Customization33077
+Node: Ellama Session Mode Line Mode33365
+Node: Enabling and Disabling (1)33950
+Node: Customization (1)34397
+Node: Using Blueprints34691
+Node: Key Components of Ellama Blueprints35310
+Node: Creating and Managing Blueprints35917
+Node: Variable Management36898
+Node: Keymap and Mode37367
+Node: Transient Menus38303
+Node: Running Blueprints programmatically38849
+Node: Acknowledgments39436
+Node: Contributions40149
+Node: GNU Free Documentation License40533
End Tag Table
diff --git a/tests/test-ellama.el b/tests/test-ellama.el
index 97a3389b67..5e7100e6c4 100644
--- a/tests/test-ellama.el
+++ b/tests/test-ellama.el
@@ -29,6 +29,7 @@
(require 'ellama-context)
(require 'ellama-transient)
(require 'ert)
+(require 'llm-fake)
(ert-deftest test-ellama--code-filter ()
(should (equal "" (ellama--code-filter "")))
@@ -38,6 +39,7 @@
(ert-deftest test-ellama-code-improve ()
(let ((original "(hello)\n")
(improved "```lisp\n(hello)\n```")
+ (ellama-provider (make-llm-fake))
prev-lines)
(with-temp-buffer
(insert original)