GNU bug report logs - #75023
31.0.50; Warning: Unused lexical variable ‘max-tokens’ -- while used in function

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Sun, 22 Dec 2024 12:12:01 UTC

Severity: minor

Tags: moreinfo

Found in version 31.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 75023 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Jean Louis <bugs <at> gnu.support>, 75023 <at> debbugs.gnu.org
Subject: Re: bug#75023: 31.0.50; Warning: Unused lexical variable ‘max-tokens’ -- while used in function
Date: Sun, 22 Dec 2024 17:01:32 +0000
tags 75023 + moreinfo
thanks

Jean Louis <bugs <at> gnu.support> writes:

> (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

Could you please send a smaller example that reproduces the bug?




This bug report was last modified 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.