branch: elpa/gptel
commit 7cf8e3b19b81c82b2c4c6e3732db9fd449c67de9
Author: Karthik Chikmagalur <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>
gptel: Fix gptel--parse-directive
gptel.el (gptel--parse-directive): Add missing 'raw' argument.
This change was lost in the feature-templates merge.
---
gptel.el | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/gptel.el b/gptel.el
index 3e91d91b47..2aa0997d5c 100644
--- a/gptel.el
+++ b/gptel.el
@@ -1022,22 +1022,26 @@ replaced with REPLACEMENT."
from-template width)))
(t "")))
-(defun gptel--parse-directive (directive)
+(defun gptel--parse-directive (directive &optional raw)
"Parse DIRECTIVE into a backend-appropriate form.
DIRECTIVE is a gptel directive: it can be a string, a list or a
function that returns either, see `gptel-directives'.
Return a cons cell consisting of the system message (a string)
-and a template consisting of alternating user/assistant
-records (a list of strings or nil)."
+and a template consisting of alternating user/LLM
+records (a list of strings or nil).
+
+If RAW is non-nil, the user/LLM records are not processed and are
+returned as a list of strings."
(and directive
(cl-etypecase directive
(string (list directive))
(function (gptel--parse-directive (funcall directive)))
- (cons (cons (car directive)
- (gptel--parse-list
- gptel-backend (cdr directive)))))))
+ (cons (if raw directive
+ (cons (car directive)
+ (gptel--parse-list
+ gptel-backend (cdr directive))))))))