Add conversations.titleGenerationPrompt configuration
This commit is contained in:
@@ -162,8 +162,7 @@ func FormatForExternalPrompt(messages []conversation.Message, system bool) strin
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
func GenerateTitle(ctx *lmcli.Context, messages []conversation.Message) (string, error) {
|
||||
const systemPrompt = `You will be shown a conversation between a user and an AI assistant. Your task is to generate a short title (8 words or less) for the provided conversation that reflects the conversation's topic. Your response is expected to be in JSON in the format shown below.
|
||||
const defaultTitleGenerationPrompt = `You will be shown a conversation between a user and an AI assistant. Your task is to generate a short title (8 words or less) for the provided conversation that reflects the conversation's topic. Your response is expected to be in JSON in the format shown below.
|
||||
|
||||
Example conversation:
|
||||
|
||||
@@ -173,6 +172,19 @@ Example response:
|
||||
|
||||
{"title": "Help with math homework"}
|
||||
`
|
||||
|
||||
func GenerateTitle(ctx *lmcli.Context, messages []conversation.Message) (string, error) {
|
||||
if ctx.Config.Conversations.TitleGenerationModel == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
var systemPrompt string
|
||||
if ctx.Config.Conversations.TitleGenerationPrompt != nil {
|
||||
systemPrompt = *ctx.Config.Conversations.TitleGenerationPrompt
|
||||
} else {
|
||||
systemPrompt = defaultTitleGenerationPrompt
|
||||
}
|
||||
|
||||
type msg struct {
|
||||
Role string
|
||||
Content string
|
||||
|
||||
Reference in New Issue
Block a user