emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/llm 9faaf7f489 1/2: Fix issue with system prompts causi


From: ELPA Syncer
Subject: [elpa] externals/llm 9faaf7f489 1/2: Fix issue with system prompts causing problems in llm-vertex
Date: Fri, 8 Dec 2023 15:58:06 -0500 (EST)

branch: externals/llm
commit 9faaf7f489e49ba958a9193392ae6335ea865382
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>

    Fix issue with system prompts causing problems in llm-vertex
    
    Vertex is not able to handle a system prompt that is separate from the user
    input in streaming mode.
    
    Also, make sure the system prompt is only appended to the first message of 
the
    conversation.
---
 NEWS.org      |  2 ++
 llm-vertex.el | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index ab2eaa07b8..f7fab77c34 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,5 @@
+* Version 0.6.1
+- Fix issue with Google Cloud Vertex not responding to messages with a system 
interaction.
 * Version 0.6
 - Add provider =llm-llamacpp=.
 * Version 0.5.2
diff --git a/llm-vertex.el b/llm-vertex.el
index 9340ab5450..485bd2046d 100644
--- a/llm-vertex.el
+++ b/llm-vertex.el
@@ -248,11 +248,13 @@ contains the model to use, which can change the request."
                                                                           
('user "user")
                                                                           
('system "system")
                                                                           
('assistant "assistant"))))))))))
-                                       (if system-prompt
+                                       ;; Only append the system prompt if 
this is the first message of the conversation.
+                                       (if (and system-prompt (= (length 
(llm-chat-prompt-interactions prompt)) 1))
                                            (cons 
(make-llm-chat-prompt-interaction
-                                                  :role 'system
-                                                  :content system-prompt)
-                                                 (llm-chat-prompt-interactions 
prompt))
+                                                  :role 'user
+                                                  :content (concat 
system-prompt (llm-chat-prompt-interaction-content
+                                                                               
    (car (llm-chat-prompt-interactions prompt)))))
+                                                 (cdr 
(llm-chat-prompt-interactions prompt)))
                                          (llm-chat-prompt-interactions 
prompt)))))))))))))
      (llm-vertex--parameters-ui prompt))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]