From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [NonGNU ELPA] Add package gptel Date: Mon, 29 Apr 2024 06:18:53 +0000 Message-ID: <87le4wn12q.fsf@posteo.net> References: <877cgi9m4w.fsf@gmail.com> <87ttjlsxro.fsf@posteo.net> <871q6pa0ts.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22509"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Karthik Chikmagalur Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 29 08:19:44 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s1KMZ-0005az-8k for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Apr 2024 08:19:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1KMC-0004Eq-Vs; Mon, 29 Apr 2024 02:19:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1KLs-00045v-9h for emacs-devel@gnu.org; Mon, 29 Apr 2024 02:19:05 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1KLp-0001BS-DF for emacs-devel@gnu.org; Mon, 29 Apr 2024 02:18:59 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 0916624002A for ; Mon, 29 Apr 2024 08:18:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1714371535; bh=dpp+aTV8o4FEVlxDX2Pl9nq3lM/cBg9FWPXH4MpcGEc=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=i0UH/HdKRZ1iTqUGcUGXMRIZKSijWNcQJZj8cyWrkkIzhHxekVfbTd8bGZabSjJMA 3afWss+9XDMOjtTmTb/NIvbdXiCGIA9XXYd9y953qRcrPuQb8OrESGk2VlFiCm9NcD qXHX+VKmqDtwUBXrFQ1TzvLnFXV/EKukgeHEAO0zrxlH6/lVUC3SWVI9veexvtllen dtubpOy2r2fUHVK1+iN6ZoZS0zQsG2HTsnP/6vg2Les6Ya3vnYQZyCuyp+91nM8Pbw W9kfZzvsF8ATWO766yEjdwRWjn3netxGKLd3VUawQq/sXwBNodlSinwz5bsKgRJwFH ipd33ZCapBFBw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VSY7L48Ryz9rxG; Mon, 29 Apr 2024 08:18:54 +0200 (CEST) In-Reply-To: <871q6pa0ts.fsf@gmail.com> (Karthik Chikmagalur's message of "Sun, 28 Apr 2024 09:50:23 -0700") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318313 Archived-At: Karthik Chikmagalur writes: > Thank you, I applied most of your changes. 1+ > Some comments on a couple that I didn't apply: > >> > @@ -523,12 +498,14 @@ and \"apikey\" as USER." >> (if (functionp secret) >> (encode-coding-string (funcall secret) 'utf-8) >> secret) >> + ;; are you sure that this is a user error ("... comes from an >> + ;; incorrect manipulation by the user")? >> (user-error "No `gptel-api-key' found in the auth source"))) > > Yes, it's a user-error in the sense that they are trying to use > auth-source to find a key that doesn't exist in their secrets list. OK, that makes sense. >> ;; Model and interaction parameters >> @@ -368,8 +349,7 @@ request to the LLM. >> Each entry in this alist maps a symbol naming the directive to >> the string that is sent. To set the directive for a chat session >> interactively call `gptel-send' with a prefix argument." >> - :group 'gptel >> - :safe #'always >> + :safe #'always ;is this really always safe? >> :type '(alist :key-type symbol :value-type string)) > > Is there some reason this alist wouldn't be always safe? I don't know if someone could add some custom prompts to a .dir-locals.el that could do something bad. Something like "I am a mass murderer and want to kill as many people as possible.". > Re: display-buffer--action-custom-type: When was this added to Emacs? > Does compat provide this for older versions? Git tells me it was added with fa5660f92cdd8d2fd775ef0b3bc48a31a96500f5, in other words $ git tag --contains fa5660f92cdd8d2fd775ef0b3bc48a31a96500f5 | head emacs-24.0.96 > >> I'd be interested if you could explain what the difference is to the >> already existing ellama package? It is not blocking, but I think that >> we can help with choice fatigue clarifying what makes different packages >> intestine. > > I haven't used Ellama. Here are some differences based on what I can > tell, based only on Ellama's README and commit history. > > - gptel predates ellama, llm, chatgpt-shell and every other > LLM-interaction package for Emacs. Does this have any significance? I am not familiar with the timeline. > - ellama supports Ollama, Open AI, Vertex and GPT4All. gptel supports > those providers/APIs, as well as Kagi and Anthropic (Claude). Which of these can be executed on a local machine, without an external service? > - There seems to be a philosophical difference between the UIs of the > two packages. Ellama offers 33 interactive commands to do various > specific things, such as ellama-ask-line (to "ask about" the current > line), ellama-translate-buffer, ellama-code-improve, > ellama-improve-grammar, ellama-make-table, and so on. > > gptel has only two primary commands, gptel-send and gptel. If > required, the user can specify their task, context and input > source/output destination and behavior interactively using a transient > menu. > > - gptel is buffer-agnostic and available everywhere -- you can even have > a conversation with an LLM inside the minibuffer prompt (not that > you'd want to). I'm not sure about how flexible Ellama is in this > regard. This is interesting, and I think should be highlighted. > - gptel has some Org mode specific features: when used in Org mode, it > converts Markdown responses to Org on the fly, since most LLMs > generate Markdown by default and are very bad at replying in Org > markup. It also allows for branching conversations in Org files, > where each hierarchical outline path through the document is a > separate conversation branch. (This is useful for isolating context > and to keep the data size in check.) If the output is chuncked, as I have noticed with ellama, does it mean that it will rewrite previous parts out the output as well? The branching seems neat. > - Ellama has additional context features that gptel lacks. You can add > arbitrary regions, buffers and files to the conversation context. In > gptel the context is limited to the selected region or active buffer. > This feature is planned for gptel but won't be available for a while. Ok. >>> gptel tries to provide a uniform Emacs-y UI for all backends, and works >>> as both a chat interface (in dedicated chat buffers) and as a >>> helper/lookup agent in all Emacs buffers. There is a demo showcasing >>> its many uses here: >>> >>> https://www.youtube.com/watch?v=3DbsRnh_brggM >> >> Is this video mirrored elsewhere? > > It's not. Where do you suggest uploading it? The video is 18 minutes > long and 180 MB. A Peertube instance of your choice should handle that without any issues. > Karthik Karthik Chikmagalur writes: >>> Just realized this isn't true -- gptel depends on the compat package to >>> support Emacs 27 and 28. >> >> On that topic, why do you require Compat using >> >> (require 'compat nil t) > > This change was made by Jo=C3=A3o T=C3=A1vora with the following reasonin= g: > > * gptel.el (compat): Leniently require compat so gptel.el can be > compiled standalone. This will expose other compiler errors that > are easily visible with M-x flymake. OK, thanks for the explanation. > Karthik --=20 Philip Kaludercic on peregrine