all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Charalampos Mitrodimas <charmitro@posteo.net>
To: Jean Louis <bugs@gnu.support>, 75023@debbugs.gnu.org
Subject: bug#75023: 31.0.50; Warning: Unused lexical variable ‘max-tokens’ -- while used in function
Date: Mon, 23 Dec 2024 00:57:37 +0000	[thread overview]
Message-ID: <53f050a3-9050-4388-9f12-42ab02af82cc@posteo.net> (raw)
In-Reply-To: <87a5cn2a0h.fsf@lco2.mail-host-address-is-not-set>

Hi Jean,

On 22/12/24 2:10 PM, Jean Louis wrote:
> (defun rcd-llm-db (prompt &optional memory rcd-llm-model temperature max-tokens top-p stream)
>    "Send PROMPT to API as decided by the database.
>
> Optional MEMORY, RCD-LLM-MODEL, TEMPERATURE, MAX-TOKENS, TOP-P, and STREAM can be used."
>    (let ((rcd-llm-model-id (rcd-db-users-defaults "llmmodels")))
>      (cond ((not rcd-llm-model-id) (rcd-warning-message "Did not find default user's LLM model. Do `M-x rcd-my-defaults' to set it."))
> 	  (t (let* ((rcd-llm-model (rcd-db-get-entry "llmmodels" "llmmodels_name" rcd-llm-model-id rcd-db))
> 		    (temperature (or temperature (rcd-db-get-entry "llmmodels" "llmmodels_temperature" rcd-llm-model-id rcd-db)))
> 		    (max-tokens (or max-tokens (rcd-db-get-entry "llmmodels" "llmmodels_maxtokens" rcd-llm-model-id rcd-db)))
> 		    (top-p (or top-p (rcd-db-get-entry "llmmodels" "llmmodels_topp" rcd-llm-model-id rcd-db)))
> 		    (llm-endpoint-id (rcd-db-get-entry "llmmodels" "llmmodels_llmendpoints" rcd-llm-model-id rcd-db))
> 		    (llm-endpoint (rcd-db-get-entry "llmendpoints" "llmendpoints_name" llm-endpoint-id rcd-db))
> 		    (llm-provider-id (rcd-db-get-entry "llmendpoints" "llmendpoints_llmproviders" llm-endpoint-id rcd-db))
> 		    (api-key (rcd-db-get-entry "llmproviders" "llmproviders_apikey" llm-provider-id rcd-db))
> 		    (authorization (concat "Bearer " api-key))
> 		    (stream (if stream t :json-false))
> 		    (url-request-method "POST")
> 		    (url-request-extra-headers
> 		     `(("Content-Type" . "application/json")
> 		       ("Authorization" . ,authorization)))
> 		    (url-request-data
> 		     (encode-coding-string
> 		      (setq rcd-llm-last-json
> 			    (json-encode
> 			     `((model . ,rcd-llm-model)
> 			       (messages . [((role . "user") (content . ,prompt))])
> 			       (temperature . ,temperature)
> 			       (max_tokens . ,max-tokens)
> 			       (top_p . ,top-p)
> 			       (stream . ,stream))))
> 		      'utf-8))
> 		    (buffer (url-retrieve-synchronously llm-endpoint)))
> 	       (rcd-llm-response buffer))))))
>
>
> in that above function I am using ,max-tokens, but with interpolation.
>
> Though, byte compiler gives warning:
>
> Unused lexical variable ‘max-tokens’ -- while used in function

I tried to reproduce this but got these instead,

In rcd-llm-db:
test.el:3:2: Warning: docstring wider than 80 characters
test.el:9:100: Warning: reference to free variable ‘rcd-db’
test.el:25:29: Warning: assignment to free variable ‘rcd-llm-last-json’

In end of data:
test.el:35:17: Warning: the function ‘rcd-llm-response’ is not known to be
     defined.
test.el:9:37: Warning: the function ‘rcd-db-get-entry’ is not known to be
     defined.
test.el:8:36: Warning: the function ‘rcd-warning-message’ is not known to be
     defined.
test.el:7:28: Warning: the function ‘rcd-db-users-defaults’ is not known 
to be
     defined.


I agree that a smaller example to reproduce this would be better.

--
C. Mitrodimas






      parent reply	other threads:[~2024-12-23  0:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22 12:10 bug#75023: 31.0.50; Warning: Unused lexical variable ‘max-tokens’ -- while used in function Jean Louis
2024-12-22 17:01 ` Stefan Kangas
2024-12-23  0:57 ` Charalampos Mitrodimas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53f050a3-9050-4388-9f12-42ab02af82cc@posteo.net \
    --to=charmitro@posteo.net \
    --cc=75023@debbugs.gnu.org \
    --cc=bugs@gnu.support \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.