[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel 3935a6dcf8 221/273: :recycle:: Untangle Gemini model
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel 3935a6dcf8 221/273: :recycle:: Untangle Gemini model and endpoint #212 (#213) |
Date: |
Wed, 1 May 2024 10:02:32 -0400 (EDT) |
branch: elpa/gptel
commit 3935a6dcf82389f9112473a7662e0ad802b124e8
Author: Cash Prokop-Weaver <56796112+cashpw@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
:recycle:: Untangle Gemini model and endpoint #212 (#213)
gptel-gemini.el (gptel-make-gemini): Decouple the Gemini model
from the API endpoint. This is to support additional model
options in the future.
---
gptel-gemini.el | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/gptel-gemini.el b/gptel-gemini.el
index ab52a61015..9609d90cac 100644
--- a/gptel-gemini.el
+++ b/gptel-gemini.el
@@ -115,7 +115,7 @@
(host "generativelanguage.googleapis.com")
(protocol "https")
(models '("gemini-pro"))
- (endpoint "/v1beta/models/gemini-pro:"))
+ (endpoint "/v1beta/models"))
"Register a Gemini backend for gptel with NAME.
@@ -126,8 +126,7 @@ CURL-ARGS (optional) is a list of additional Curl arguments.
HOST (optional) is the API host, defaults to
\"generativelanguage.googleapis.com\".
-MODELS is a list of available model names. Currently only
-\"gemini-pro\" is available.
+MODELS is a list of available model names.
STREAM is a boolean to enable streaming responses, defaults to
false.
@@ -135,8 +134,7 @@ false.
PROTOCOL (optional) specifies the protocol, \"https\" by default.
ENDPOINT (optional) is the API endpoint for completions, defaults to
-\"/v1beta/models/gemini-pro:streamGenerateContent\" if STREAM is true and
-\"/v1beta/models/gemini-pro:generateContent\" otherwise.
+\"/v1beta/models\".
HEADER (optional) is for additional headers to send with each
request. It should be an alist or a function that retuns an
@@ -156,18 +154,18 @@ function that returns the key."
:endpoint endpoint
:stream stream
:key key
- :url
- (if stream
- (lambda ()
- (concat protocol "://" host endpoint
- (if gptel-stream
- "streamGenerateContent"
- "generateContent")
- "?key=" (gptel--get-api-key)))
- (lambda ()
- (concat protocol "://" host endpoint
- "generateContent" "?key="
- (gptel--get-api-key)))))))
+ :url (lambda ()
+ (let ((method (if (and stream
+ gptel-stream)
+ "streamGenerateContent"
+ "generateContent")))
+ (format "%s://%s%s/%s:%s?key=%s"
+ protocol
+ host
+ endpoint
+ gptel-model
+ method
+ (gptel--get-api-key)))))))
(prog1 backend
(setf (alist-get name gptel--known-backends
nil nil #'equal)
- [nongnu] elpa/gptel 3dd00a7457 145/273: gptel-gemini: Add streaming responses, simplify configuration, (continued)
- [nongnu] elpa/gptel 3dd00a7457 145/273: gptel-gemini: Add streaming responses, simplify configuration, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 8d3e08faa8 157/273: gptel: Don't use called-interactively-p, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel febeada960 172/273: gptel: Make gptel-backend customizable, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 612aea3456 178/273: gptel: Make gptel-post-response-* easier to use, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel f7ba368c38 055/273: gptel: More flexible callbacks, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 1a554785e8 149/273: gptel-curl: Remove redundant calls to insert-response, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 2e92c0303c 156/273: gptel: gptel-backend-url can accept functions, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 2c87acddd5 200/273: gptel: Add request logging (Fix #165), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel d8c604b53b 202/273: README: Update with instructions for perplexity.ai (#204), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel eb088f2f21 213/273: gptel-anthropic: support Anthropic AI's Claude 3 (#229), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 3935a6dcf8 221/273: :recycle:: Untangle Gemini model and endpoint #212 (#213),
ELPA Syncer <=
- [nongnu] elpa/gptel 260be9d8d4 230/273: gptel: Consolidate HTTP request process, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 53a905dafc 253/273: gptel: Show chosen system message in header-line, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 306fe3bd8c 269/273: gptel-ollama: Fix parsing error (#179), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 97ab6cbd1e 273/273: gptel: Add .elpaignore, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 4356f6fbec 103/273: gptel: correct system message with gptel-request, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 3308449761 133/273: gptel: Fix prompt string handling in gptel-request, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 190d1d20e2 121/273: gptel: Update header line and package info description, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel f571323174 163/273: gptel-gemini: Simulate system-message for gemini, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 7c2e342f35 176/273: gptel-transient: Add prompting from kill-ring, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 1752f1d589 180/273: gptel-kagi: Add support for the Kagi summarizer, ELPA Syncer, 2024/05/01