Update [2025-06-27 Fri 16:25]

This commit is contained in:
Phil Bajsicki 2025-06-27 16:25:27 +02:00
commit a87fb723c3

View file

@ -65,6 +65,13 @@ config.el:
(require 'gptel-got)
(mapcar (lambda (tool) (cl-pushnew tool gptel-tools)) gptel-got)
#+end_src
** Configuration:
*** Variables
| Default | Variable name | Type | Description |
| '() | gptel-got-skip-heading-extraction | list | ~org-extract-headings~ will skip buffer names matching strings in this list |
| 40000 | gptel-got-result-limit | number | *[Required!]* If tool output > result-limit, instructs the LLM to try something else. |
| t | gptel-got-timestamp-toggle | bool | If ~t~, string =#+current_time:= append current date to it. |
** Code
*** Preamble
:PROPERTIES:
@ -130,11 +137,7 @@ Use ~setq~ in your configuration, with a list of buffer names whose headings you
#+end_src
**** result-limit
When in local use, with a large dataset, a lot of the commands which return entire org-mode entries... end up grabbing way, way too much text.
The stop-gap solution is to implement a hard limit on the amount of text a tool can return.
I don't think there's much reason to ever allow partial results, which led me to this:
This stop-gap solution puts a hard limit on tool result length to prevent context overflow. Applied to a number of tools.
#+begin_src elisp :results none
(defvar gptel-got-result-limit 40000)
@ -147,17 +150,6 @@ I don't think there's much reason to ever allow partial results, which led me to
#+end_src
Use ~setq~ in your configuration, e.g.:
#+begin_src elisp :tangle no :results none
(setq gptel-got-result-limit 40000)
#+end_src
This will *prevent* tools from returning results longer than 40,000 characters. Instead, the LLM will receive a message saying it should be much more specific in its queries, which will hopefully guide it to be more specific.
By default the limit is 40k, as that's just over the longest months I've kept my journal through.
The functionality for withholding results is only applied to select functions that are known to cause issues.
*** Helper Functions
These abstract away some of the tool definitions. They're called from each function, depending on their intended output.