Documentation
¶
Overview ¶
A “prompt” refers to the input to the model.
This input is rarely hard coded, but rather is often constructed from multiple components. A PromptTemplate is responsible for the construction of this input.
PromptTemplate is powered by Go text/template, however we provided simplistic interface to interact with. Everything is a string and data passed along to the template as map[string]string.
Example :
template, _ := NewPromptTemplate("template_name", "{{.string}} {{.stringfloat}} {{.stringinteger}}") Data := map[string]string{"string": "string", "stringfloat": "0.1", "stringinteger": "1"} outputPrompt, _ := P.FormatPrompt(Data)
outputPrompt will containt "string 0.1 1"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PromptTemplate ¶
type PromptTemplate struct {
// contains filtered or unexported fields
}
func NewPromptTemplate ¶
func NewPromptTemplate(name string, templateString string) (output_template *PromptTemplate, err error)
NewPromptTemplate create a new prompt template
func (*PromptTemplate) FormatPrompt ¶
func (P *PromptTemplate) FormatPrompt(Data map[string]string) (output_prompt string, err error)
FormatPrompt to generate prompt from template
Click to show internal directories.
Click to hide internal directories.