gptel: Allow dynamically overriding preset parameters during apply #940
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a preset's
:pre
callback returns a plist, use it to augment/override the preset's normal specification.This is a proposed implementation for "functional" presets, as discussed in #905 (though it's a bit different than the solution discussed there).
I believe it's also a more generic solution to the issue that's currently being solved by the special handling of
:append
in presets that specify:tools
. If a preset wants to specify:prompt-transform-functions
, for example, this change allows appending or inserting into the current globalgptel-prompt-transform-functions
, rather than overwriting it.Naturally this would somewhat change the contract of the
:pre
function, and if there's anyone out there who's idly returning a plist, this could introduce unexpected side effects. I don't expect that's a particularly common case. However, another option would be to use a more explicitly-named field like:override
for this function, instead of:pre
.