-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling system message #339
base: master
Are you sure you want to change the base?
Conversation
Means that it can be set to `nil` and won't be supplied in requests.
@karthink I just wanted to kindly remind you about this PR, in case it may have slipped your attention. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three sources that combine to form the system message in gptel:
gptel--system-message
,- the "additional directive" option for quick instructions from the transient menu, and
- the context chunks added via
gptel-add
, assuminggptel-use-system
is set tosystem
.
Sources 2 and 3 have to be explicitly specified, and source 1 is automatic. This PR should not disable 2 and 3 when disabling 1.
@@ -110,7 +110,10 @@ | |||
(list :text (string-trim | |||
(buffer-substring-no-properties (point-min) (point-max))))) | |||
prompts)) | |||
(cl-callf (lambda (msg) (concat gptel--system-message "\n\n" msg)) | |||
(cl-callf (lambda (msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, you can avoid the whole cl-callf
statement if no system message is available.
(truncate-string-to-width prompt (- width 30) nil nil t)) | ||
")") | ||
'face 'shadow)) | ||
(if prompt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be possible to disable the system message from the transient menu. It should probably be a standalone option in the menu, bound to <delete>
or something.
@@ -806,7 +821,8 @@ Or in an extended conversation: | |||
:position position | |||
:in-place (and in-place (not output-to-other-buffer-p)) | |||
:stream stream | |||
:system (concat gptel--system-message system-extra) | |||
:system (when gptel--system-message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's no system message, it should still be possible to add an additional directive from the transient menu (the d
option captured in system-extra
here). This will now function as the whole system message.
@@ -374,7 +374,8 @@ transient menu interface provided by `gptel-menu'." | |||
'((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") | |||
(programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") | |||
(writing . "You are a large language model and a writing assistant. Respond concisely.") | |||
(chat . "You are a large language model and a conversation partner. Respond concisely.")) | |||
(chat . "You are a large language model and a conversation partner. Respond concisely.") | |||
(none)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is none
an option here? There appears to be no way to actually choose this to select nil
as the value of gptel--system-message
.
@@ -968,7 +970,8 @@ Model parameters can be let-bound around calls to this function." | |||
(declare (indent 1)) | |||
(let* ((gptel--system-message | |||
;Add context chunks to system message if required | |||
(if (and gptel-context--alist | |||
(if (and system |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's no system message but there are context chunks (and gptel-use-context
is set to system
), they should still be supplied as the context.
Hey, just a quick heads-up, I haven't forgotten about this, but vacation off the computer and other priorities kept me from implementing your improvements. Thank you already for the review! |
Is there anything one can do to help to test this? |
It would be best to rebase this PR onto the |
Means that it can be set to
nil
and won't be supplied in requests.(Requested here: #249 (comment))