[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/llm cff9ab8f3c 22/34: Centralize nonfree llm warnings,
From: |
Andrew Hyatt |
Subject: |
[elpa] externals/llm cff9ab8f3c 22/34: Centralize nonfree llm warnings, and warn with a targeted type |
Date: |
Sat, 16 Sep 2023 01:32:49 -0400 (EDT) |
branch: externals/llm
commit cff9ab8f3c65f7ad92f0f0cb133df980cbcd4d6e
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>
Centralize nonfree llm warnings, and warn with a targeted type
---
llm-openai.el | 4 +---
llm-vertex.el | 4 +---
llm.el | 6 ++++++
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/llm-openai.el b/llm-openai.el
index ec20d34875..a0e0c4fe56 100644
--- a/llm-openai.el
+++ b/llm-openai.el
@@ -51,9 +51,7 @@ will use a reasonable default."
key chat-model embedding-model)
(defun llm-openai--maybe-warn ()
- (when llm-warn-on-nonfree
- (warn "Open AI's API is not free software, and your freedom to use it is
restricted by Open AI's terms of service.
-See https://openai.com/policies/terms-of-use for the restrictions on use.")))
+ (llm--warn-on-nonfree "Open AI" "https://openai.com/policies/terms-of-use"))
(defun llm-openai--embedding-make-request (provider string vector-callback
error-callback sync)
"Make a request to Open AI to get an embedding for STRING.
diff --git a/llm-vertex.el b/llm-vertex.el
index 551403a59e..e072ee533a 100644
--- a/llm-vertex.el
+++ b/llm-vertex.el
@@ -70,9 +70,7 @@ KEY-GENTIME keeps track of when the key was generated,
because the key must be r
(setf (llm-vertex-key-gentime provider) (current-time))))
(defun llm-vertex-maybe-warn ()
- (when llm-warn-on-nonfree
- (warn "Google Cloud's Vertex AI is not free software, and your freedom to
use it is restricted by Google's terms of service.
-See https://policies.google.com/terms/generative-ai for more information.")))
+ (llm--warn-on-nonfree "Google Cloud Vertex"
"https://policies.google.com/terms/generative-ai"))
(defun llm-vertex--embedding (provider string vector-callback error-callback
sync)
"Get the embedding for STRING.
diff --git a/llm.el b/llm.el
index de2e05bbe3..408a5ab17b 100644
--- a/llm.el
+++ b/llm.el
@@ -48,6 +48,12 @@
"Whether to issue a warning when using a non-free LLM."
:type 'boolean)
+(defun llm--warn-on-nonfree (name tos)
+ "Issue a warning if `llm-warn-on-nonfree' is non-nil."
+ (when llm-warn-on-nonfree
+ (lwarn '(llm nonfree) :warning "%s API is not free software, and your
freedom to use it restricted.
+See %s for the details on the restrictions on use." name tos)))
+
(cl-defstruct llm-chat-prompt
"This stores all the information needed for a structured chat prompt.
- [elpa] externals/llm 3b761aca25 02/34: Add README.org, (continued)
- [elpa] externals/llm 3b761aca25 02/34: Add README.org, Andrew Hyatt, 2023/09/16
- [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 <=
- [elpa] externals/llm ad230d9d6b 10/34: Add methods for nil provider, to throw more meaningful errors, Andrew Hyatt, 2023/09/16
- [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