toolKits := []tools.Tool{xxx, xxx} history := memory.NewChatMessageHistory() for idx, conversation := range conversations { if idx&0x1 == 0 { err = history.AddUserMessage(ctx, conversation) } else { err = history.AddAIMessage(ctx, conversation) } } mem := agents.WithMemory(memory.NewConversationBuffer(memory.WithChatHistory(history))) agent := agents.NewExecutor(agents.NewOneShotAgent(llm, toolKits), toolKits, mem) result, err = chains.Run(ctx, agent, input, options...)
Above code snippet, add chat history to agents, however, the final request sent to the llm has no chat history.
toolKits := []tools.Tool{xxx, xxx} history := memory.NewChatMessageHistory() for idx, conversation := range conversations { if idx&0x1 == 0 { err = history.AddUserMessage(ctx, conversation) } else { err = history.AddAIMessage(ctx, conversation) } } mem := agents.WithMemory(memory.NewConversationBuffer(memory.WithChatHistory(history))) agent := agents.NewExecutor(agents.NewOneShotAgent(llm, toolKits), toolKits, mem) result, err = chains.Run(ctx, agent, input, options...)
Above code snippet, add chat history to agents, however, the final request sent to the llm has no chat history.