Memory with MultiQueryRetriever #3643
Replies: 1 comment 1 reply
-
🤖 Hey there @obadahalak! 🚀 I'm Dosu, your friendly bot assistant. I'm here to help you squash those bugs, answer your questions, and guide you on your journey to becoming a contributor. While we wait for a human maintainer to join us, feel free to ask me anything. Let's make your coding journey smoother together! 🤖 💡🎈 Based on the information provided, it seems like you want to use the First, you would initialize your const messageHistory = new FirestoreChatMessageHistory({
collectionName: "langchain",
sessionId,
userId: "[email protected]",
config: { projectId: "your-project-id" },
});
const model = new ChatAnthropic({});
const retriever = MultiQueryRetriever.fromLLM({
llm: model,
retriever: vectorstore.asRetriever(),
verbose: true,
}); Then, you could use the await messageHistory.addUserMessage("What are mitochondria made of?"); Next, you could use the const query = "What are mitochondria made of?";
const retrievedDocs = await retriever.getRelevantDocuments(query); Finally, you could use the await messageHistory.addAIChatMessage(retrievedDocs[0].pageContent); Please note that this is a simplified example and the actual implementation may vary based on your specific requirements. Also, this code assumes that the For more details, you can refer to the following files in the langchainjs repository:
I hope this helps! If you have any further questions, please let me know. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
how I can use FirestoreChatMessageHistory with MultiQueryRetriever in the following code...

Beta Was this translation helpful? Give feedback.
All reactions