Skip to content
Discussion options

You must be logged in to vote

simplest solution was to do the following:

import { type BaseMessage } from 'langchain/schema'
import { RedisChatMessageHistory } from 'langchain/stores/message/ioredis'

class ExtendedRedisChatMemory extends RedisChatMessageHistory {
  async addMessage (message: BaseMessage): Promise<void> {
    message.additional_kwargs = {
      timestamp: new Date().getTime()
    }
    await super.addMessage(message)
  }
}

export default ExtendedRedisChatMemory

Which is a bit of a hack. Ideally I could pass in the timestamp of the message being sent from the client for the HumanMessage as opposed to the system time.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rysloan4
Comment options

You must be logged in to vote
1 reply
@stevenmilstein
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants