Skip to content

Adding conversation title to chat message history #22824

Answered by SollalF
PaSchwarz asked this question in Q&A
Discussion options

You must be logged in to vote

The easiest way to do this would be to implement BaseChatMessageHistory and to modify the init function:

class CustomChatMessageHistory(BaseChatMessageHistory):
    
    thread_name: str
    
    def __init__(self, thread_name: str):
        super().__init__()  # Initialize parent class
                
        self.thread_name = thread_name
        
        return
        
   # Implement abstract methods here

And to pass the name when you create the CustomChatMessageHistory

def get_session_history(user_id: str, conversation_id: str, thread_name: str) -> BaseChatMessageHistory:
    if (user_id, conversation_id) not in store:
        store[(user_id, conversation_id)] = CustomChatMessageHis…

Replies: 1 comment

Comment options

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