gptel: checkdoc linting and indentation rules

* gptel.el (gptel-use-header-line, gptel--parse-buffer):
Docstrings.

* gptel-transient.el (gptel--transient-read-variable): Docstring.

* gptel-openai.el (gptel-make-openai, gptel-make-azure): Add
indent declaration.

* gptel-ollama.el (gptel-make-ollama): Add indent declaration.

* gptel-kagi.el (gptel-make-kagi): Add indent declaration.

* gptel-gemini.el (gptel-make-gemini): Add indent declaration.
This commit is contained in:
Karthik Chikmagalur 2024-01-19 14:19:22 -08:00
parent 7b19cdf117
commit d0c685e501
6 changed files with 15 additions and 8 deletions

View file

@ -135,6 +135,7 @@ alist, like:
KEY (optional) is a variable whose value is the API key, or KEY (optional) is a variable whose value is the API key, or
function that returns the key." function that returns the key."
(declare (indent 1))
(let ((backend (gptel--make-gemini (let ((backend (gptel--make-gemini
:name name :name name
:host host :host host

View file

@ -156,6 +156,7 @@ Example:
------- -------
(gptel-make-kagi \"Kagi\" :key my-kagi-key)" (gptel-make-kagi \"Kagi\" :key my-kagi-key)"
(declare (indent 1))
stream ;Silence byte-compiler stream ;Silence byte-compiler
(let ((backend (gptel--make-kagi (let ((backend (gptel--make-kagi
:name name :name name

View file

@ -138,6 +138,7 @@ Example:
:host \"localhost:11434\" :host \"localhost:11434\"
:models \\='(\"mistral:latest\") :models \\='(\"mistral:latest\")
:stream t)" :stream t)"
(declare (indent 1))
(let ((backend (gptel--make-ollama (let ((backend (gptel--make-ollama
:name name :name name
:host host :host host

View file

@ -142,6 +142,7 @@ alist, like:
KEY (optional) is a variable whose value is the API key, or KEY (optional) is a variable whose value is the API key, or
function that returns the key." function that returns the key."
(declare (indent 1))
(let ((backend (gptel--make-openai (let ((backend (gptel--make-openai
:name name :name name
:host host :host host
@ -201,6 +202,7 @@ Example:
\"/openai/deployments/DEPLOYMENT_NAME/completions?api-version=2023-05-15\" \"/openai/deployments/DEPLOYMENT_NAME/completions?api-version=2023-05-15\"
:stream t :stream t
:models \\='(\"gpt-3.5-turbo\" \"gpt-4\"))" :models \\='(\"gpt-3.5-turbo\" \"gpt-4\"))"
(declare (indent 1))
(let ((backend (gptel--make-openai (let ((backend (gptel--make-openai
:name name :name name
:host host :host host

View file

@ -257,7 +257,10 @@ Customize `gptel-directives' for task-specific prompts."
;; ** Infixes for model parameters ;; ** Infixes for model parameters
(defun gptel--transient-read-variable (prompt initial-input history) (defun gptel--transient-read-variable (prompt initial-input history)
"Read value from minibuffer and interpret the result as a Lisp object." "Read value from minibuffer and interpret the result as a Lisp object.
PROMPT, INITIAL-INPUT and HISTORY are as in the Transient reader
documention."
(ignore-errors (ignore-errors
(read-from-minibuffer prompt initial-input read-expression-map t history))) (read-from-minibuffer prompt initial-input read-expression-map t history)))
@ -402,7 +405,7 @@ will get progressively longer!"
(list (line-beginning-position) (line-end-position)))))) (list (line-beginning-position) (line-end-position))))))
((member "y" args) ((member "y" args)
(unless (car-safe kill-ring) (unless (car-safe kill-ring)
(user-error "`kill-ring' is empty! Nothing to send.")) (user-error "`kill-ring' is empty! Nothing to send"))
(if current-prefix-arg (if current-prefix-arg
(read-from-kill-ring "Prompt from kill-ring: ") (read-from-kill-ring "Prompt from kill-ring: ")
(current-kill 0)))))) (current-kill 0))))))

View file

@ -297,8 +297,7 @@ is only inserted in dedicated gptel buffers before the AI's response."
:type '(alist :key-type symbol :value-type string)) :type '(alist :key-type symbol :value-type string))
(defcustom gptel-use-header-line t (defcustom gptel-use-header-line t
"Whether `gptel-mode' should use header-line for status "Whether `gptel-mode' should use header-line for status information.
information.
When set to nil, use the mode line for (minimal) status When set to nil, use the mode line for (minimal) status
information and the echo area for messages." information and the echo area for messages."
@ -806,6 +805,7 @@ streamed, as in `gptel-stream'. Do not set this if you are
specifying a custom CALLBACK! specifying a custom CALLBACK!
Model parameters can be let-bound around calls to this function." Model parameters can be let-bound around calls to this function."
(declare (indent 1))
(let* ((gptel-stream stream) (let* ((gptel-stream stream)
(start-marker (start-marker
(cond (cond
@ -985,8 +985,7 @@ there."
(gptel--parse-buffer gptel-backend max-entries))))) (gptel--parse-buffer gptel-backend max-entries)))))
(cl-defgeneric gptel--parse-buffer (backend max-entries) (cl-defgeneric gptel--parse-buffer (backend max-entries)
"Parse the current buffer backwards from point and return a list "Parse current buffer backwards from point and return a list of prompts.
of prompts.
BACKEND is the LLM backend in use. BACKEND is the LLM backend in use.