Add more logging
This commit is contained in:
@@ -100,6 +100,7 @@ func New(opts ...Option) (*Agent, error) {
|
|||||||
"character", a.Character.String(),
|
"character", a.Character.String(),
|
||||||
"state", a.State().String(),
|
"state", a.State().String(),
|
||||||
"goal", a.options.permanentGoal,
|
"goal", a.options.permanentGoal,
|
||||||
|
"model", a.options.LLMAPI.Model,
|
||||||
)
|
)
|
||||||
|
|
||||||
return a, nil
|
return a, nil
|
||||||
@@ -131,7 +132,7 @@ func (a *Agent) ConversationChannel() chan openai.ChatCompletionMessage {
|
|||||||
// Ask is a pre-emptive, blocking call that returns the response as soon as it's ready.
|
// Ask is a pre-emptive, blocking call that returns the response as soon as it's ready.
|
||||||
// It discards any other computation.
|
// It discards any other computation.
|
||||||
func (a *Agent) Ask(opts ...JobOption) *JobResult {
|
func (a *Agent) Ask(opts ...JobOption) *JobResult {
|
||||||
xlog.Debug("Agent Ask()", "agent", a.Character.Name)
|
xlog.Debug("Agent Ask()", "agent", a.Character.Name, "model", a.options.LLMAPI.Model)
|
||||||
defer func() {
|
defer func() {
|
||||||
xlog.Debug("Agent has finished being asked", "agent", a.Character.Name)
|
xlog.Debug("Agent has finished being asked", "agent", a.Character.Name)
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -172,12 +172,15 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
model := a.defaultModel
|
model := a.defaultModel
|
||||||
multimodalModel := a.defaultMultimodalModel
|
multimodalModel := a.defaultMultimodalModel
|
||||||
|
|
||||||
if config.MultimodalModel != "" {
|
if config.MultimodalModel != "" {
|
||||||
multimodalModel = config.MultimodalModel
|
multimodalModel = config.MultimodalModel
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Model != "" {
|
if config.Model != "" {
|
||||||
model = config.Model
|
model = config.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.PeriodicRuns == "" {
|
if config.PeriodicRuns == "" {
|
||||||
config.PeriodicRuns = "10m"
|
config.PeriodicRuns = "10m"
|
||||||
}
|
}
|
||||||
@@ -200,15 +203,14 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
|||||||
|
|
||||||
connectors := a.connectors(config)
|
connectors := a.connectors(config)
|
||||||
promptBlocks := a.promptBlocks(config)
|
promptBlocks := a.promptBlocks(config)
|
||||||
|
|
||||||
actions := a.availableActions(config)(ctx, a)
|
actions := a.availableActions(config)(ctx, a)
|
||||||
|
|
||||||
stateFile, characterFile := a.stateFiles(name)
|
stateFile, characterFile := a.stateFiles(name)
|
||||||
|
|
||||||
actionsLog := []string{}
|
actionsLog := []string{}
|
||||||
for _, action := range actions {
|
for _, action := range actions {
|
||||||
actionsLog = append(actionsLog, action.Definition().Name.String())
|
actionsLog = append(actionsLog, action.Definition().Name.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
connectorLog := []string{}
|
connectorLog := []string{}
|
||||||
for _, connector := range connectors {
|
for _, connector := range connectors {
|
||||||
connectorLog = append(connectorLog, fmt.Sprintf("%+v", connector))
|
connectorLog = append(connectorLog, fmt.Sprintf("%+v", connector))
|
||||||
@@ -305,6 +307,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.HUD {
|
if config.HUD {
|
||||||
opts = append(opts, EnableHUD)
|
opts = append(opts, EnableHUD)
|
||||||
}
|
}
|
||||||
@@ -328,9 +331,11 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
|||||||
if config.CanStopItself {
|
if config.CanStopItself {
|
||||||
opts = append(opts, CanStopItself)
|
opts = append(opts, CanStopItself)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.InitiateConversations {
|
if config.InitiateConversations {
|
||||||
opts = append(opts, EnableInitiateConversations)
|
opts = append(opts, EnableInitiateConversations)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.RandomIdentity {
|
if config.RandomIdentity {
|
||||||
if config.IdentityGuidance != "" {
|
if config.IdentityGuidance != "" {
|
||||||
opts = append(opts, WithRandomIdentity(config.IdentityGuidance))
|
opts = append(opts, WithRandomIdentity(config.IdentityGuidance))
|
||||||
@@ -342,6 +347,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
|||||||
if config.EnableKnowledgeBase {
|
if config.EnableKnowledgeBase {
|
||||||
opts = append(opts, EnableKnowledgeBase)
|
opts = append(opts, EnableKnowledgeBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.EnableReasoning {
|
if config.EnableReasoning {
|
||||||
opts = append(opts, EnableForceReasoning)
|
opts = append(opts, EnableForceReasoning)
|
||||||
}
|
}
|
||||||
@@ -351,6 +357,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
xlog.Info("Starting agent", "name", name, "config", config)
|
xlog.Info("Starting agent", "name", name, "config", config)
|
||||||
|
|
||||||
agent, err := New(opts...)
|
agent, err := New(opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -367,6 +374,7 @@ func (a *AgentPool) startAgentWithConfig(name string, config *AgentConfig) error
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
xlog.Info("Starting connectors", "name", name, "config", config)
|
xlog.Info("Starting connectors", "name", name, "config", config)
|
||||||
|
|
||||||
for _, c := range connectors {
|
for _, c := range connectors {
|
||||||
go c.Start(agent)
|
go c.Start(agent)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,6 +184,8 @@ func (a *App) UpdateAgentConfig(pool *state.AgentPool) func(c *fiber.Ctx) error
|
|||||||
return errorJSONMessage(c, "Error updating agent: "+err.Error())
|
return errorJSONMessage(c, "Error updating agent: "+err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xlog.Info("Updated agent", "name", agentName, "config", fmt.Sprintf("%+v", newConfig))
|
||||||
|
|
||||||
return statusJSONMessage(c, "ok")
|
return statusJSONMessage(c, "ok")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user