Add prompt blocks
This commit is contained in:
@@ -30,6 +30,8 @@ type options struct {
|
||||
kbResults int
|
||||
ragdb RAGDB
|
||||
|
||||
prompts []PromptBlock
|
||||
|
||||
systemPrompt string
|
||||
|
||||
// callbacks
|
||||
@@ -37,6 +39,11 @@ type options struct {
|
||||
resultCallback func(ActionState)
|
||||
}
|
||||
|
||||
type PromptBlock interface {
|
||||
Render(a *Agent) string
|
||||
Role() string
|
||||
}
|
||||
|
||||
func defaultOptions() *options {
|
||||
return &options{
|
||||
periodicRuns: 15 * time.Minute,
|
||||
@@ -140,6 +147,16 @@ func WithCharacterFile(path string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithPrompts adds additional block prompts to the agent
|
||||
// to be rendered internally in the conversation
|
||||
// when processing the conversation to the LLM
|
||||
func WithPrompts(prompts ...PromptBlock) Option {
|
||||
return func(o *options) error {
|
||||
o.prompts = prompts
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithLLMAPIKey(key string) Option {
|
||||
return func(o *options) error {
|
||||
o.LLMAPI.APIKey = key
|
||||
|
||||
Reference in New Issue
Block a user