chore(prompts): Rename Prompt blocks to Dynamic prompts
This commit is contained in:
@@ -39,7 +39,7 @@ type options struct {
|
||||
kbResults int
|
||||
ragdb RAGDB
|
||||
|
||||
prompts []PromptBlock
|
||||
prompts []DynamicPrompt
|
||||
|
||||
systemPrompt string
|
||||
|
||||
@@ -212,7 +212,7 @@ 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 {
|
||||
func WithPrompts(prompts ...DynamicPrompt) Option {
|
||||
return func(o *options) error {
|
||||
o.prompts = prompts
|
||||
return nil
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package agent
|
||||
|
||||
type PromptBlock interface {
|
||||
type DynamicPrompt interface {
|
||||
Render(a *Agent) (string, error)
|
||||
Role() string
|
||||
}
|
||||
|
||||
@@ -18,22 +18,22 @@ type ActionsConfig struct {
|
||||
Config string `json:"config"`
|
||||
}
|
||||
|
||||
type PromptBlocksConfig struct {
|
||||
type DynamicPromptsConfig struct {
|
||||
Type string `json:"type"`
|
||||
Config string `json:"config"`
|
||||
}
|
||||
|
||||
func (d PromptBlocksConfig) ToMap() map[string]string {
|
||||
func (d DynamicPromptsConfig) ToMap() map[string]string {
|
||||
config := map[string]string{}
|
||||
json.Unmarshal([]byte(d.Config), &config)
|
||||
return config
|
||||
}
|
||||
|
||||
type AgentConfig struct {
|
||||
Connector []ConnectorConfig `json:"connectors" form:"connectors" `
|
||||
Actions []ActionsConfig `json:"actions" form:"actions"`
|
||||
PromptBlocks []PromptBlocksConfig `json:"promptblocks" form:"promptblocks"`
|
||||
MCPServers []agent.MCPServer `json:"mcp_servers" form:"mcp_servers"`
|
||||
Connector []ConnectorConfig `json:"connectors" form:"connectors" `
|
||||
Actions []ActionsConfig `json:"actions" form:"actions"`
|
||||
DynamicPrompts []DynamicPromptsConfig `json:"dynamic_prompts" form:"dynamic_prompts"`
|
||||
MCPServers []agent.MCPServer `json:"mcp_servers" form:"mcp_servers"`
|
||||
|
||||
Description string `json:"description" form:"description"`
|
||||
|
||||
@@ -63,14 +63,18 @@ type AgentConfig struct {
|
||||
}
|
||||
|
||||
type AgentConfigMeta struct {
|
||||
Fields []config.Field
|
||||
Connectors []config.FieldGroup
|
||||
Actions []config.FieldGroup
|
||||
PromptBlocks []config.Field
|
||||
MCPServers []config.Field
|
||||
Fields []config.Field
|
||||
Connectors []config.FieldGroup
|
||||
Actions []config.FieldGroup
|
||||
DynamicPrompts []config.FieldGroup
|
||||
MCPServers []config.Field
|
||||
}
|
||||
|
||||
func NewAgentConfigMeta(actionsConfig []config.FieldGroup, connectorsConfig []config.FieldGroup) AgentConfigMeta {
|
||||
func NewAgentConfigMeta(
|
||||
actionsConfig []config.FieldGroup,
|
||||
connectorsConfig []config.FieldGroup,
|
||||
dynamicPromptsConfig []config.FieldGroup,
|
||||
) AgentConfigMeta {
|
||||
return AgentConfigMeta{
|
||||
Fields: []config.Field{
|
||||
{
|
||||
@@ -261,9 +265,9 @@ func NewAgentConfigMeta(actionsConfig []config.FieldGroup, connectorsConfig []co
|
||||
Required: true,
|
||||
},
|
||||
},
|
||||
PromptBlocks: []config.Field{},
|
||||
Connectors: connectorsConfig,
|
||||
Actions: actionsConfig,
|
||||
DynamicPrompts: dynamicPromptsConfig,
|
||||
Connectors: connectorsConfig,
|
||||
Actions: actionsConfig,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ type AgentPool struct {
|
||||
imageModel, localRAGAPI, localRAGKey, apiKey string
|
||||
availableActions func(*AgentConfig) func(ctx context.Context, pool *AgentPool) []types.Action
|
||||
connectors func(*AgentConfig) []Connector
|
||||
promptBlocks func(*AgentConfig) []PromptBlock
|
||||
dynamicPrompt func(*AgentConfig) []DynamicPrompt
|
||||
timeout string
|
||||
conversationLogs string
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func NewAgentPool(
|
||||
LocalRAGAPI string,
|
||||
availableActions func(*AgentConfig) func(ctx context.Context, pool *AgentPool) []types.Action,
|
||||
connectors func(*AgentConfig) []Connector,
|
||||
promptBlocks func(*AgentConfig) []PromptBlock,
|
||||
promptBlocks func(*AgentConfig) []DynamicPrompt,
|
||||
timeout string,
|
||||
withLogs bool,
|
||||
) (*AgentPool, error) {
|
||||
@@ -107,7 +107,7 @@ func NewAgentPool(
|
||||
managers: make(map[string]sse.Manager),
|
||||
connectors: connectors,
|
||||
availableActions: availableActions,
|
||||
promptBlocks: promptBlocks,
|
||||
dynamicPrompt: promptBlocks,
|
||||
timeout: timeout,
|
||||
conversationLogs: conversationPath,
|
||||
}, nil
|
||||
@@ -131,7 +131,7 @@ func NewAgentPool(
|
||||
pool: *poolData,
|
||||
connectors: connectors,
|
||||
localRAGAPI: LocalRAGAPI,
|
||||
promptBlocks: promptBlocks,
|
||||
dynamicPrompt: promptBlocks,
|
||||
availableActions: availableActions,
|
||||
timeout: timeout,
|
||||
conversationLogs: conversationPath,
|
||||
@@ -303,7 +303,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
||||
}
|
||||
|
||||
connectors := a.connectors(config)
|
||||
promptBlocks := a.promptBlocks(config)
|
||||
promptBlocks := a.dynamicPrompt(config)
|
||||
actions := a.availableActions(config)(ctx, a)
|
||||
stateFile, characterFile := a.stateFiles(name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user