emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/elisa 860936af49 5/7: Disable batch embeddings by defau


From: ELPA Syncer
Subject: [elpa] externals/elisa 860936af49 5/7: Disable batch embeddings by default
Date: Sat, 23 Nov 2024 12:57:57 -0500 (EST)

branch: externals/elisa
commit 860936af490b1392c9477603005941f6ec0ba321
Author: Sergey Kostyaev <kostyaev.sergey2@wb.ru>
Commit: Sergey Kostyaev <kostyaev.sergey2@wb.ru>

    Disable batch embeddings by default
---
 README.org | 4 ++++
 elisa.el   | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index b1176d571d..acf155f1e0 100644
--- a/README.org
+++ b/README.org
@@ -305,6 +305,10 @@ Example configuration.
     * Type: String
     * Description: Template used for rewriting prompts for better retrieval.
 
++ ~elisa-batch-embeddings-enabled~:
+    * Type: Boolean
+    * Description: Enable batch embeddings if supported.
+
 **** Web Search and Integration
 
 + ~elisa-searxng-url~:
diff --git a/elisa.el b/elisa.el
index 91d829e397..70932a9c9a 100644
--- a/elisa.el
+++ b/elisa.el
@@ -275,6 +275,10 @@ If set, all quotes with similarity less than threshold 
will be filtered out."
   "Supported complex document file extensions."
   :type '(repeat string))
 
+(defcustom elisa-batch-embeddings-enabled nil
+  "Enable batch embeddings if supported."
+  :type 'boolean)
+
 (defun elisa-supported-complex-document-p (path)
   "Check if PATH contain supported complex document."
   (cl-find (file-name-extension path)
@@ -467,7 +471,8 @@ FOREIGN KEY(collection_id) REFERENCES collections(rowid)
   "Calculate embeddings for CHUNKS.
 Return list of vectors."
   (let ((provider elisa-embeddings-provider))
-    (if (member 'embeddings-batch (llm-capabilities provider))
+    (if (and elisa-batch-embeddings-enabled
+            (member 'embeddings-batch (llm-capabilities provider)))
        (llm-batch-embeddings provider chunks)
       (mapcar (lambda (chunk) (llm-embedding provider chunk)) chunks))))
 
@@ -1259,6 +1264,7 @@ Call ON-DONE callback with result as an argument after 
FUNC evaluation done."
                    ,(async-inject-variables "elisa-find-executable")
                    ,(async-inject-variables "elisa-tar-executable")
                    ,(async-inject-variables "elisa-prompt-rewriting-enabled")
+                   ,(async-inject-variables "elisa-batch-embeddings-enabled")
                    ,(async-inject-variables "elisa-rewrite-prompt-template")
                    ,(async-inject-variables "elisa-semantic-split-function")
                    ,(async-inject-variables 
"elisa-webpage-extraction-function")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]