[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/llm ad230d9d6b 10/34: Add methods for nil provider, to
From: |
Andrew Hyatt |
Subject: |
[elpa] externals/llm ad230d9d6b 10/34: Add methods for nil provider, to throw more meaningful errors |
Date: |
Sat, 16 Sep 2023 01:32:48 -0400 (EDT) |
branch: externals/llm
commit ad230d9d6bf895d46b82b9b24dfdbb9e511c0e96
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>
Add methods for nil provider, to throw more meaningful errors
---
llm.el | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/llm.el b/llm.el
index e527dd9273..f513489f09 100644
--- a/llm.el
+++ b/llm.el
@@ -93,6 +93,9 @@ The return value will be the value passed into the success
callback."
PROMPT is a `llm-chat-prompt'. The response is a string."
(llm--run-async-as-sync #'llm-chat-response-async provider prompt))
+(cl-defmethod llm-chat-response ((_ (eql nil)) _)
+ (error "LLM provider was nil. Please set the provider in the application
you are using."))
+
(cl-defgeneric llm-chat-response-async (provider prompt response-callback
error-callback)
"Return a response to PROMPT from PROVIDER.
PROMPT is a `llm-chat-prompt'.
@@ -101,10 +104,16 @@ ERROR-CALLBACK receives the error response."
(ignore provider prompt response-callback error-callback)
(signal 'not-implemented nil))
+(cl-defmethod llm-chat-response-async ((_ (eql nil)) _ _ _)
+ (error "LLM provider was nil. Please set the provider in the application
you are using."))
+
(cl-defgeneric llm-embedding (provider string)
"Return a vector embedding of STRING from PROVIDER."
(llm--run-async-as-sync #'llm-embedding-async provider string))
+(cl-defmethod llm-chat-embedding ((_ (eql nil)) _)
+ (error "LLM provider was nil. Please set the provider in the application
you are using."))
+
(cl-defgeneric llm-embedding-async (provider string vector-callback
error-callback)
"Calculate a vector embedding of STRING from PROVIDER.
VECTOR-CALLBACK will be called with the vector embedding.
@@ -113,6 +122,9 @@ error signal and a string message."
(ignore provider string vector-callback error-callback)
(signal 'not-implemented nil))
+(cl-defmethod llm-embedding-async ((_ (eql nil)) _ _ _)
+ (error "LLM provider was nil. Please set the provider in the application
you are using."))
+
(cl-defgeneric llm-count-tokens (provider string)
"Return the number of tokens in STRING from PROVIDER.
This may be an estimate if the LLM does not provide an exact
- [elpa] externals/llm ad76cff80b 01/34: Initial checkin of the llm package for emacs., (continued)
- [elpa] externals/llm ad76cff80b 01/34: Initial checkin of the llm package for emacs., Andrew Hyatt, 2023/09/16
- [elpa] externals/llm cff5db8ad5 16/34: Add unit tests and fix all brokenness detected by them, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 131a7ee5d3 12/34: Solve flaky errors when using sync llm commands, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 48ae59d149 14/34: Fix llm-chat-prompt-to-text, which was unusable, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 636014bf64 08/34: Make all remaining code async-friendly, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 9e3040bad2 20/34: Add warnings requested by GNU about nonfree software, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm c8b14b4d9c 19/34: Fix fake provider embedding func and remove async unit tests, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 9057a50df4 11/34: Fix indenting in llm--run-async-as-sync, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm c322577b9b 13/34: Test both sync and async commands, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm cff9ab8f3c 22/34: Centralize nonfree llm warnings, and warn with a targeted type, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm ad230d9d6b 10/34: Add methods for nil provider, to throw more meaningful errors,
Andrew Hyatt <=
- [elpa] externals/llm 650bba65d5 25/34: Improve the docstring for llm--warn-on-nonfree, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm b2f1605514 33/34: Delete some trailing whitespace, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 39ae6fc794 34/34: Assign copyright to FSF, in preparation of inclusion to GNU ELPA, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 9a3fc01cac 17/34: Switch from generic to per-provider sync solution, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm eba797b295 04/34: Implement error handling for gcloud auth issues, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 16ee85fd11 05/34: Add async options, and made the sync options just use those and wait, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm 3919b77383 06/34: Implement confusion and typos in README.org, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm b52958757a 18/34: Fix docstring wider than 80 characters in llm-vertex, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm abbff2aa9d 23/34: Change method name to llm-chat (without "-response"), update README, Andrew Hyatt, 2023/09/16
- [elpa] externals/llm e94bc937c7 27/34: Fix issue with llm-chat before method having too many arguments, Andrew Hyatt, 2023/09/16