The Prompt
type represents a system prompt with versioning and enhancement capabilities.
type Prompt struct {
Prompt string // The actual prompt text
Version string // Version of the prompt
Enhanced []Prompt // Collection of enhanced versions of this prompt
}
// Create a new system prompt
prompt := sapiens.NewSystemPrompt(
"You are an AI assistant named .",
"v1.0"
)
// Parse the prompt with parameters
params := map[string]string{"name": "Sapiens"}
parsedPrompt, err := prompt.Parse(prompt.Prompt, params)
func NewSystemPrompt(prompt string, version string) Prompt
Creates a new Prompt with the specified text and version.
func (s *Prompt) SetEnhanced(enhanced Prompt)
Adds an enhanced version of the prompt.
func (s *Prompt) GetLatestEnhanced() Prompt
Returns the most recent enhanced version of the prompt.
func (s *Prompt) Parse(raw string, parameters map[string]string) (output Prompt, err error)
Parses a prompt template with provided parameters to create a fully rendered prompt.
Field | Type | Description |
---|---|---|
Prompt | string | The actual prompt text |
Version | string | Version identifier of the prompt |
Enhanced | []Prompt | Collection of enhanced versions of this prompt |