From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Charalampos Mitrodimas Newsgroups: gmane.emacs.bugs Subject: bug#75023: 31.0.50; Warning: Unused lexical variable =?UTF-8?Q?=E2=80=98max-tokens=E2=80=99?= -- while used in function Date: Mon, 23 Dec 2024 00:57:37 +0000 Message-ID: <53f050a3-9050-4388-9f12-42ab02af82cc@posteo.net> References: <87a5cn2a0h.fsf@lco2.mail-host-address-is-not-set> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29556"; mail-complaints-to="usenet@ciao.gmane.io" To: Jean Louis , 75023@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 23 01:58:40 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1tPWmN-0007Wc-Qa for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Dec 2024 01:58:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPWlz-0005Q4-Eh; Sun, 22 Dec 2024 19:58:15 -0500 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 1tPWln-0005PN-UE for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 19:58:05 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPWlm-0005nr-Fs for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 19:58:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=FLtvkgB2AoGHI9Mb5h8ywCyWYZ+zf1tXnV8jXatwSHI=; b=fZJaAXo8TSiovskr/JHzYJ1CSu3B30Tmib99BBai/o9s6xeCQTh0/C6sMh5fwoZVE7sS3mR44jOGznaicfQxkwAKUdsnP/YH3JaQ3UyFcIpwXCFGh7qHu0Ip3m9higCrbtnsKtsVBlDrEsoNPm0phP508MEWfosIWQa9zjX2gpKoWlBbmu5wFLbCmJ7em/ZUmTbZr9iS8+d02IMeDI0oFDnVPki5+iSc3a6LJu5JSEjK9EiriJdgZ0GXAmYqu2qa0psHPcDTGTgWfoLGyWk7r753zhSWVYGlzDWfS9dDujqKeQVwlFAuhKQBd6Ub9mfcHWPdLQoNo+lP9ip6EUJPXA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tPWll-0003br-V4 for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 19:58:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Charalampos Mitrodimas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Dec 2024 00:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75023 X-GNU-PR-Package: emacs Original-Received: via spool by 75023-submit@debbugs.gnu.org id=B75023.173491547413856 (code B ref 75023); Mon, 23 Dec 2024 00:58:01 +0000 Original-Received: (at 75023) by debbugs.gnu.org; 23 Dec 2024 00:57:54 +0000 Original-Received: from localhost ([127.0.0.1]:52542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPWld-0003bQ-Fv for submit@debbugs.gnu.org; Sun, 22 Dec 2024 19:57:53 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:57753) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPWlX-0003an-Il for 75023@debbugs.gnu.org; Sun, 22 Dec 2024 19:57:51 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 95C94240101 for <75023@debbugs.gnu.org>; Mon, 23 Dec 2024 01:57:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1734915460; bh=GvfOBqy6DlWWtHV86e9jEuq1Mx4BedqS5Lz73sAPPAU=; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type: Content-Transfer-Encoding:From; b=UjUzBxRBKrGf4RDs5PsyFUicfLbij4eBu9aropdX4pfTCjvxzgJYGFLHvITCc/r26 TdfMbEEcQX6Rr/tzLk3+EzeyBi/XRRKc8KCkQ6rKZjlLWMehpdoAv8NVieG4oOQaSB FN7Nu/y26lhIGuSNhVcYxBxlOM0iinck4k1KsqZmFvj5YOlkrkjY8V35rG/Kdac0Oy 9oDWXD3kw0HLbJg2GiLIf5V3EmF/5bHp6Hr7h4TrnpPoCjgByUNJ0O2EiENxO8G3DD lnQEHGzlEYFUdSzDEVt3Lv37ASka3wCCmAH8MjD37AIK3mqHKcSU7jWdV1BeGcpsXp UriSsxv52BEpA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YGfkq1xfhz9rxF; Mon, 23 Dec 2024 01:57:39 +0100 (CET) Content-Language: en-US In-Reply-To: <87a5cn2a0h.fsf@lco2.mail-host-address-is-not-set> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297636 Archived-At: 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