This repository has been archived on 2024-01-13. You can view files and clone it, but cannot push or open issues or pull requests.
Kevin/pkg/structs/prompt.go
2023-04-17 17:52:14 +02:00

22 lines
528 B
Go

package structs
import "github.com/spf13/viper"
func GeneratePrompt(config *viper.Viper, history []Message, message Message) string {
var prompt string = "Below is an instruction. Write a response as " + config.GetString("name") + " that appropriately answers the question.\n"
prompt += GenerateHistory(history)
prompt += message.String()
return prompt
}
func GenerateHistory(messages []Message) string {
var history string = ""
for _, message := range messages {
history += message.String()
}
return history
}