Put logging of conversations behind ENABLE_CONVERSATIONS_LOGGING
This commit is contained in:
@@ -72,12 +72,18 @@ func NewAgentPool(
|
|||||||
connectors func(*AgentConfig) []Connector,
|
connectors func(*AgentConfig) []Connector,
|
||||||
promptBlocks func(*AgentConfig) []PromptBlock,
|
promptBlocks func(*AgentConfig) []PromptBlock,
|
||||||
timeout string,
|
timeout string,
|
||||||
|
withLogs bool,
|
||||||
) (*AgentPool, error) {
|
) (*AgentPool, error) {
|
||||||
// if file exists, try to load an existing pool.
|
// if file exists, try to load an existing pool.
|
||||||
// if file does not exist, create a new pool.
|
// if file does not exist, create a new pool.
|
||||||
|
|
||||||
poolfile := filepath.Join(directory, "pool.json")
|
poolfile := filepath.Join(directory, "pool.json")
|
||||||
|
|
||||||
|
conversationPath := ""
|
||||||
|
if withLogs {
|
||||||
|
conversationPath = filepath.Join(directory, "conversations")
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(poolfile); err != nil {
|
if _, err := os.Stat(poolfile); err != nil {
|
||||||
// file does not exist, create a new pool
|
// file does not exist, create a new pool
|
||||||
return &AgentPool{
|
return &AgentPool{
|
||||||
@@ -95,7 +101,7 @@ func NewAgentPool(
|
|||||||
availableActions: availableActions,
|
availableActions: availableActions,
|
||||||
promptBlocks: promptBlocks,
|
promptBlocks: promptBlocks,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
conversationLogs: filepath.Join(directory, "conversations"),
|
conversationLogs: conversationPath,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +124,7 @@ func NewAgentPool(
|
|||||||
promptBlocks: promptBlocks,
|
promptBlocks: promptBlocks,
|
||||||
availableActions: availableActions,
|
availableActions: availableActions,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
conversationLogs: filepath.Join(directory, "conversations"),
|
conversationLogs: conversationPath,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -16,6 +16,7 @@ var apiKey = os.Getenv("API_KEY")
|
|||||||
var timeout = os.Getenv("TIMEOUT")
|
var timeout = os.Getenv("TIMEOUT")
|
||||||
var stateDir = os.Getenv("STATE_DIR")
|
var stateDir = os.Getenv("STATE_DIR")
|
||||||
var localRAG = os.Getenv("LOCAL_RAG")
|
var localRAG = os.Getenv("LOCAL_RAG")
|
||||||
|
var withLogs = os.Getenv("ENABLE_CONVERSATIONS_LOGGING") == "true"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if testModel == "" {
|
if testModel == "" {
|
||||||
@@ -52,6 +53,7 @@ func main() {
|
|||||||
services.Connectors,
|
services.Connectors,
|
||||||
services.PromptBlocks,
|
services.PromptBlocks,
|
||||||
timeout,
|
timeout,
|
||||||
|
withLogs,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user