Documentation
¶
Index ¶
- type Prompt
- func (instance *Prompt) GetContent() string
- func (instance *Prompt) GetLang() string
- func (instance *Prompt) LoadContent(uri string) *Prompt
- func (instance *Prompt) Map() map[string]interface{}
- func (instance *Prompt) PayloadMergeWith(m map[string]interface{}, overwrite bool) *Prompt
- func (instance *Prompt) Render(data ...interface{}) (response string, err error)
- func (instance *Prompt) SplitContent() (context string, prompt string)
- func (instance *Prompt) SplitContentRows() (context []string, prompt []string)
- func (instance *Prompt) String() string
- type PromptDocuArticlePayload
- type PromptDocuMsgBottomPayload
- type PromptDocuMsgTopPayload
- type PromptMiscMaxTokensPayload
- type PromptMiscMaxWordsPayload
- type PromptPackage
- func (instance *PromptPackage) Clone() *PromptPackage
- func (instance *PromptPackage) Count() int
- func (instance *PromptPackage) Deploy(root string, overwrite bool) (err error)
- func (instance *PromptPackage) ForEach(callback func(name, lang string, prompt *Prompt) (err error)) error
- func (instance *PromptPackage) Load(packageDir string) (response []string, err error)
- func (instance *PromptPackage) Map() map[string]interface{}
- func (instance *PromptPackage) Name() string
- func (instance *PromptPackage) Names() []string
- func (instance *PromptPackage) Root(v ...string) string
- func (instance *PromptPackage) Store() (response *PromptStore)
- func (instance *PromptPackage) String() string
- type PromptPackages
- func (instance *PromptPackages) Add(item *PromptPackage) (response *PromptPackages)
- func (instance *PromptPackages) Count() int
- func (instance *PromptPackages) Deploy() (err error)
- func (instance *PromptPackages) DeployTo(root string, overwrite bool) (err error)
- func (instance *PromptPackages) Exists(name string) (response bool)
- func (instance *PromptPackages) ForEach(callback func(packageName, name, lang string, prompt *Prompt) (err error)) error
- func (instance *PromptPackages) ForEachPackage(callback func(pkg *PromptPackage) (err error)) error
- func (instance *PromptPackages) Get(name string) (response *PromptPackage)
- func (instance *PromptPackages) GetOverwrite() bool
- func (instance *PromptPackages) Load() (response []string, err error)
- func (instance *PromptPackages) LoadDir(packagesDir string) (response []string, err error)
- func (instance *PromptPackages) LoadDirs(packagesDir []string) (response []string, err error)
- func (instance *PromptPackages) Map() map[string]interface{}
- func (instance *PromptPackages) Name() (response string)
- func (instance *PromptPackages) Names() (response []string)
- func (instance *PromptPackages) New(name string) (response *PromptPackage)
- func (instance *PromptPackages) Prompt(packageName, name, lang string) (response *Prompt)
- func (instance *PromptPackages) PromptAdd(packageName, lang, name, text string) (err error)
- func (instance *PromptPackages) PromptDeploy(packageName, lang, name, text, root string, options map[string]interface{}, ...) (err error)
- func (instance *PromptPackages) PromptExists(promptName string) bool
- func (instance *PromptPackages) PromptExistsLang(promptName string, lang string) bool
- func (instance *PromptPackages) PromptGet(promptName, promptLang string) (response *Prompt)
- func (instance *PromptPackages) PromptGetDefault(promptName string) (response *Prompt)
- func (instance *PromptPackages) PromptLoadFile(packageName, lang, filename string) (promptName string, err error)
- func (instance *PromptPackages) PromptNames() (response []string)
- func (instance *PromptPackages) PromptNamesFromPackage(packageName string) (response []string)
- func (instance *PromptPackages) Root(v ...string) string
- func (instance *PromptPackages) SetOverwrite(v bool) *PromptPackages
- func (instance *PromptPackages) SetRoot(v string) *PromptPackages
- func (instance *PromptPackages) String() string
- type PromptStore
- func (instance *PromptStore) Add(lang, name, text string) (err error)
- func (instance *PromptStore) AddItem(prompt *Prompt) (err error)
- func (instance *PromptStore) AddWithOptions(lang, name, text string, options map[string]interface{}) (err error)
- func (instance *PromptStore) Clone() (response *PromptStore)
- func (instance *PromptStore) Deploy(lang, name, text string, optRoot string, options map[string]interface{}, ...) (err error)
- func (instance *PromptStore) Exists(name string) (response bool)
- func (instance *PromptStore) ExistsLang(name, lang string) (response bool)
- func (instance *PromptStore) ForEach(callback func(name, lang string, prompt *Prompt) (err error)) error
- func (instance *PromptStore) Get(lang, name string) (response *Prompt)
- func (instance *PromptStore) LoadDir(path string) (response []string, err error)
- func (instance *PromptStore) LoadDirs(paths []string) (response []string, err error)
- func (instance *PromptStore) LoadFile(lang, filename string) (promptName string, err error)
- func (instance *PromptStore) Map() (response map[string]interface{})
- func (instance *PromptStore) Names() (response []string)
- func (instance *PromptStore) Root(v ...string) string
- func (instance *PromptStore) String() string
- type PromptValueParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prompt ¶
type Prompt struct { Name string `json:"name"` Lang string `json:"lang"` Content string `json:"content"` Payload map[string]interface{} `json:"payload,omitempty"` // payload for rendering Options map[string]interface{} `json:"options,omitempty"` // options for LLMs when prompt is passed as parameter // contains filtered or unexported fields }
func (*Prompt) GetContent ¶
func (*Prompt) LoadContent ¶
func (*Prompt) PayloadMergeWith ¶
func (*Prompt) SplitContent ¶
func (*Prompt) SplitContentRows ¶
SplitContentRows splits the content of a Prompt instance into context and prompt rows separated by the PromptSeparator "---". CONTEXT is the first row if the prompt has more than 1 row. PROMPT is a sequence of rows after the first separated from ---
type PromptDocuArticlePayload ¶
type PromptDocuArticlePayload struct { Lang string `json:"lang"` Topic string `json:"topic"` MessageTop string `json:"message_top"` MessageBottom string `json:"message_bottom"` }
func (*PromptDocuArticlePayload) Map ¶
func (instance *PromptDocuArticlePayload) Map() map[string]interface{}
func (*PromptDocuArticlePayload) String ¶
func (instance *PromptDocuArticlePayload) String() string
type PromptDocuMsgBottomPayload ¶
type PromptDocuMsgBottomPayload struct {
Value string `json:"docu_msg_bottom_value"`
}
func (*PromptDocuMsgBottomPayload) Map ¶
func (instance *PromptDocuMsgBottomPayload) Map() map[string]interface{}
func (*PromptDocuMsgBottomPayload) String ¶
func (instance *PromptDocuMsgBottomPayload) String() string
type PromptDocuMsgTopPayload ¶
type PromptDocuMsgTopPayload struct {
Value string `json:"docu_msg_top_value"`
}
func (*PromptDocuMsgTopPayload) Map ¶
func (instance *PromptDocuMsgTopPayload) Map() map[string]interface{}
func (*PromptDocuMsgTopPayload) String ¶
func (instance *PromptDocuMsgTopPayload) String() string
type PromptMiscMaxTokensPayload ¶
type PromptMiscMaxTokensPayload struct {
Value string `json:"value"`
}
func (*PromptMiscMaxTokensPayload) Map ¶
func (instance *PromptMiscMaxTokensPayload) Map() map[string]interface{}
func (*PromptMiscMaxTokensPayload) String ¶
func (instance *PromptMiscMaxTokensPayload) String() string
type PromptMiscMaxWordsPayload ¶
type PromptMiscMaxWordsPayload struct {
Value string `json:"value"`
}
func (*PromptMiscMaxWordsPayload) Map ¶
func (instance *PromptMiscMaxWordsPayload) Map() map[string]interface{}
func (*PromptMiscMaxWordsPayload) String ¶
func (instance *PromptMiscMaxWordsPayload) String() string
type PromptPackage ¶
type PromptPackage struct {
// contains filtered or unexported fields
}
PromptPackage represents a container for prompt configuration and logic in a conversational AI application. A package is a group of prompts
func NewPromptPackage ¶
func NewPromptPackage(name string) (instance *PromptPackage)
func (*PromptPackage) Clone ¶
func (instance *PromptPackage) Clone() *PromptPackage
func (*PromptPackage) Count ¶
func (instance *PromptPackage) Count() int
func (*PromptPackage) Deploy ¶
func (instance *PromptPackage) Deploy(root string, overwrite bool) (err error)
Deploy writes the prompt files from the PromptPackage to the specified directory. dir: The target directory to deploy prompt files. overwrite: A flag to determine whether to overwrite existing files. Returns an error if the deployment fails.
func (*PromptPackage) ForEach ¶
func (instance *PromptPackage) ForEach(callback func(name, lang string, prompt *Prompt) (err error)) error
func (*PromptPackage) Load ¶
func (instance *PromptPackage) Load(packageDir string) (response []string, err error)
func (*PromptPackage) Map ¶
func (instance *PromptPackage) Map() map[string]interface{}
func (*PromptPackage) Name ¶
func (instance *PromptPackage) Name() string
func (*PromptPackage) Names ¶
func (instance *PromptPackage) Names() []string
func (*PromptPackage) Root ¶
func (instance *PromptPackage) Root(v ...string) string
func (*PromptPackage) Store ¶
func (instance *PromptPackage) Store() (response *PromptStore)
func (*PromptPackage) String ¶
func (instance *PromptPackage) String() string
type PromptPackages ¶
type PromptPackages struct {
// contains filtered or unexported fields
}
PromptPackages is a collection that maps package names to their PromptPackage instances.
func NewPromptPackages ¶
func NewPromptPackages() (instance *PromptPackages)
func (*PromptPackages) Add ¶
func (instance *PromptPackages) Add(item *PromptPackage) (response *PromptPackages)
func (*PromptPackages) Count ¶
func (instance *PromptPackages) Count() int
func (*PromptPackages) Deploy ¶
func (instance *PromptPackages) Deploy() (err error)
func (*PromptPackages) DeployTo ¶
func (instance *PromptPackages) DeployTo(root string, overwrite bool) (err error)
DeployTo deploys all packages in PromptPackages to the specified root directory. root: The target directory for deployment. overwrite: Whether to overwrite existing files. Returns an error if any package deployment fails. Target Dir is: ./root/pkg_name/prompt_name
func (*PromptPackages) Exists ¶
func (instance *PromptPackages) Exists(name string) (response bool)
func (*PromptPackages) ForEach ¶
func (instance *PromptPackages) ForEach(callback func(packageName, name, lang string, prompt *Prompt) (err error)) error
func (*PromptPackages) ForEachPackage ¶
func (instance *PromptPackages) ForEachPackage(callback func(pkg *PromptPackage) (err error)) error
func (*PromptPackages) Get ¶
func (instance *PromptPackages) Get(name string) (response *PromptPackage)
func (*PromptPackages) GetOverwrite ¶
func (instance *PromptPackages) GetOverwrite() bool
func (*PromptPackages) Load ¶
func (instance *PromptPackages) Load() (response []string, err error)
func (*PromptPackages) LoadDir ¶
func (instance *PromptPackages) LoadDir(packagesDir string) (response []string, err error)
func (*PromptPackages) LoadDirs ¶
func (instance *PromptPackages) LoadDirs(packagesDir []string) (response []string, err error)
func (*PromptPackages) Map ¶
func (instance *PromptPackages) Map() map[string]interface{}
func (*PromptPackages) Name ¶
func (instance *PromptPackages) Name() (response string)
func (*PromptPackages) Names ¶
func (instance *PromptPackages) Names() (response []string)
func (*PromptPackages) New ¶
func (instance *PromptPackages) New(name string) (response *PromptPackage)
func (*PromptPackages) Prompt ¶
func (instance *PromptPackages) Prompt(packageName, name, lang string) (response *Prompt)
func (*PromptPackages) PromptAdd ¶
func (instance *PromptPackages) PromptAdd(packageName, lang, name, text string) (err error)
func (*PromptPackages) PromptDeploy ¶
func (instance *PromptPackages) PromptDeploy(packageName, lang, name, text, root string, options map[string]interface{}, overwrite bool) (err error)
func (*PromptPackages) PromptExists ¶
func (instance *PromptPackages) PromptExists(promptName string) bool
func (*PromptPackages) PromptExistsLang ¶
func (instance *PromptPackages) PromptExistsLang(promptName string, lang string) bool
func (*PromptPackages) PromptGet ¶
func (instance *PromptPackages) PromptGet(promptName, promptLang string) (response *Prompt)
func (*PromptPackages) PromptGetDefault ¶
func (instance *PromptPackages) PromptGetDefault(promptName string) (response *Prompt)
func (*PromptPackages) PromptLoadFile ¶
func (instance *PromptPackages) PromptLoadFile(packageName, lang, filename string) (promptName string, err error)
func (*PromptPackages) PromptNames ¶
func (instance *PromptPackages) PromptNames() (response []string)
func (*PromptPackages) PromptNamesFromPackage ¶
func (instance *PromptPackages) PromptNamesFromPackage(packageName string) (response []string)
func (*PromptPackages) Root ¶
func (instance *PromptPackages) Root(v ...string) string
func (*PromptPackages) SetOverwrite ¶
func (instance *PromptPackages) SetOverwrite(v bool) *PromptPackages
func (*PromptPackages) SetRoot ¶
func (instance *PromptPackages) SetRoot(v string) *PromptPackages
func (*PromptPackages) String ¶
func (instance *PromptPackages) String() string
type PromptStore ¶
type PromptStore struct {
// contains filtered or unexported fields
}
func NewPromptStore ¶
func NewPromptStore() (instance *PromptStore)
func (*PromptStore) Add ¶
func (instance *PromptStore) Add(lang, name, text string) (err error)
Add prompt to store but do not write any file. Use "Deploy" to create a file on file system.
func (*PromptStore) AddItem ¶
func (instance *PromptStore) AddItem(prompt *Prompt) (err error)
func (*PromptStore) AddWithOptions ¶
func (instance *PromptStore) AddWithOptions(lang, name, text string, options map[string]interface{}) (err error)
func (*PromptStore) Clone ¶
func (instance *PromptStore) Clone() (response *PromptStore)
func (*PromptStore) Exists ¶
func (instance *PromptStore) Exists(name string) (response bool)
func (*PromptStore) ExistsLang ¶
func (instance *PromptStore) ExistsLang(name, lang string) (response bool)
func (*PromptStore) ForEach ¶
func (instance *PromptStore) ForEach(callback func(name, lang string, prompt *Prompt) (err error)) error
func (*PromptStore) Get ¶
func (instance *PromptStore) Get(lang, name string) (response *Prompt)
func (*PromptStore) LoadDir ¶
func (instance *PromptStore) LoadDir(path string) (response []string, err error)
func (*PromptStore) LoadDirs ¶
func (instance *PromptStore) LoadDirs(paths []string) (response []string, err error)
func (*PromptStore) LoadFile ¶
func (instance *PromptStore) LoadFile(lang, filename string) (promptName string, err error)
func (*PromptStore) Map ¶
func (instance *PromptStore) Map() (response map[string]interface{})
func (*PromptStore) Names ¶
func (instance *PromptStore) Names() (response []string)
func (*PromptStore) Root ¶
func (instance *PromptStore) Root(v ...string) string
func (*PromptStore) String ¶
func (instance *PromptStore) String() string
type PromptValueParser ¶
type PromptValueParser struct { Prefix string PromptName string PromptParams map[string]interface{} Value string }
func NewPromptValueParser ¶
func NewPromptValueParser(text string) (instance *PromptValueParser)