Allow to specify dynamic prompts

This commit is contained in:
Ettore Di Giacinto
2025-03-02 22:40:37 +01:00
parent 5721c52c0d
commit f6e16be170
10 changed files with 237 additions and 13 deletions

View File

@@ -42,11 +42,6 @@ type options struct {
resultCallback func(ActionState)
}
type PromptBlock interface {
Render(a *Agent) string
Role() string
}
func defaultOptions() *options {
return &options{
periodicRuns: 15 * time.Minute,
@@ -182,6 +177,22 @@ func WithPrompts(prompts ...PromptBlock) Option {
}
}
// WithDynamicPrompts is a helper function to create dynamic prompts
// Dynamic prompts contains golang code which is executed dynamically
// // to render a prompt to the LLM
// func WithDynamicPrompts(prompts ...map[string]string) Option {
// return func(o *options) error {
// for _, p := range prompts {
// prompt, err := NewDynamicPrompt(p, "")
// if err != nil {
// return err
// }
// o.prompts = append(o.prompts, prompt)
// }
// return nil
// }
// }
func WithLLMAPIKey(key string) Option {
return func(o *options) error {
o.LLMAPI.APIKey = key