-
Notifications
You must be signed in to change notification settings - Fork 2.5k
TypeError: chatMessage._getType is not a function #1573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @riccardolinares , how did you manage chat history ? maybe you mixmatch custom and default chat memory history. |
I am working with Next.js and I create an API Route that take the question and the history from the body of the request. api/chat:
On the page this is my code: index.tsx
and if the response from the API Route is ok, I update the MessageState as follow:
I am not sure if it is clear enough... in case let me know |
Hey @riccardolinares , what kind of chain are you using const response = await chain.call({
question: question,
chat_history: history || [],
}); Not sure it expect to pass directly the chat_history like that |
These are my chain and model:
btw it seems like the _getType() function is not found at all :/ |
Also getting this issue, I believe it's a new breaking change but not sure where it's introduced. |
Hi @bryceamacker @riccardolinares The documentation is pretty bad for this case . There is two solutions to manage custom history using ConversationalRetrievalQAChain.
|
this works, thanks for the help @borel |
I was using an array of strings to manage the chat history. Converting the array into a single string solved my problem! :) Thanks! |
I came across this issue too after upgrade langchain to 0.0.90. And I fixed the issue in my fork. https://github.com/davideuler/gpt4-pdf-chatbot-langchain-chromadb |
This is a clean approach, using @borel second strategy. Thanks! |
This worked for me: import { AIMessage, HumanMessage } from "@langchain/core/messages";
chatHistory.push(new HumanMessage(initialPrompt), new AIMessage(response.text)); |
I m following the YT tutorial, but after the first message sent correctly, the second one give me this error:
Version:
"langchain": "^0.0.91",
The text was updated successfully, but these errors were encountered: