Add customizable system prompt

This commit is contained in:
mudler
2024-04-10 20:35:04 +02:00
parent 0dda705017
commit 230d012915
4 changed files with 26 additions and 0 deletions

View File

@@ -207,6 +207,16 @@ func (a *Agent) consumeJob(job *Job, role string) {
})
}
if a.options.systemPrompt != "" {
if !Messages(a.currentConversation).Exist(a.options.systemPrompt) {
a.currentConversation = append([]openai.ChatCompletionMessage{
{
Role: "system",
Content: a.options.systemPrompt,
}}, a.currentConversation...)
}
}
// RAG
if memory {
// Walk conversation from bottom to top, and find the first message of the user