[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/llm 9e3040bad2 20/34: Add warnings requested by GNU abo
From: |
Andrew Hyatt |
Subject: |
[elpa] externals/llm 9e3040bad2 20/34: Add warnings requested by GNU about nonfree software |
Date: |
Sat, 16 Sep 2023 01:32:49 -0400 (EDT) |
branch: externals/llm
commit 9e3040bad27b8d73c2292127ccfc2c612eed1e8e
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>
Add warnings requested by GNU about nonfree software
Also this correctly sets up the LLM customization group.
---
llm-openai.el | 7 +++++++
llm-vertex.el | 7 +++++++
llm.el | 8 ++++++++
3 files changed, 22 insertions(+)
diff --git a/llm-openai.el b/llm-openai.el
index 199ee86f14..ec20d34875 100644
--- a/llm-openai.el
+++ b/llm-openai.el
@@ -50,11 +50,17 @@ EMBEDDING-MODEL is the model to use for embeddings. If
unset, it
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.")))
+
(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.
PROVIDER, VECTOR-CALLBACK and ERROR-CALLBACK are as in the
`llm-embedding-async' call. SYNC is non-nil when the request
should wait until the response is received."
+ (llm-openai--maybe-warn)
(unless (llm-openai-key provider)
(error "To call Open AI API, add a key to the `llm-openai' provider."))
(request "https://api.openai.com/v1/embeddings"
@@ -98,6 +104,7 @@ ERROR-CALLBACK is called if there is an error, with the error
signal and message.
SYNC is non-nil when the request should wait until the response is received."
+ (llm-openai--maybe-warn)
(unless (llm-openai-key provider)
(error "To call Open AI API, the key must have been set"))
(let (request-alist system-prompt)
diff --git a/llm-vertex.el b/llm-vertex.el
index 25f0be4259..551403a59e 100644
--- a/llm-vertex.el
+++ b/llm-vertex.el
@@ -69,12 +69,18 @@ KEY-GENTIME keeps track of when the key was generated,
because the key must be r
(setf (llm-vertex-key provider) result))
(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.")))
+
(defun llm-vertex--embedding (provider string vector-callback error-callback
sync)
"Get the embedding for STRING.
PROVIDER, VECTOR-CALLBACK, ERROR-CALLBACK are all the same as
`llm-embedding-async'. SYNC, when non-nil, will wait until the
response is available to return."
(llm-vertex-refresh-key provider)
+ (llm-vertex-maybe-warn)
(request (format
"https://%s-aiplatform.googleapis.com/v1/projects/%s/locations/%s/publishers/google/models/%s:predict"
llm-vertex-gcloud-region
(llm-vertex-project provider)
@@ -112,6 +118,7 @@ PROVIDER, RESPONSE-CALLBACK, ERROR-CALLBACK are all the
same as
`llm-chat-response-async'. SYNC, when non-nil, will wait until
the response is available to return."
(llm-vertex-refresh-key provider)
+ (llm-vertex-maybe-warn)
(let ((request-alist))
(when (llm-chat-prompt-context prompt)
(push `("context" . ,(llm-chat-prompt-context prompt)) request-alist))
diff --git a/llm.el b/llm.el
index f01a130cf8..de2e05bbe3 100644
--- a/llm.el
+++ b/llm.el
@@ -40,6 +40,14 @@
(require 'cl-lib)
+(defgroup llm nil
+ "Interface to pluggable llm backends."
+ :group 'external)
+
+(defcustom llm-warn-on-nonfree t
+ "Whether to issue a warning when using a non-free LLM."
+ :type 'boolean)
+
(cl-defstruct llm-chat-prompt
"This stores all the information needed for a structured chat prompt.
- [elpa] branch externals/llm created (now 39ae6fc794), Andrew Hyatt, 2023/09/16
- [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 <=
- [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, 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