mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-03 12:07:36 +00:00
community[minor]: Add async methods to CassandraChatMessageHistory (#21975)
This commit is contained in:
committed by
GitHub
parent
37cfc00310
commit
fea6b99b16
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
import time
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from langchain.memory import ConversationBufferMemory
|
||||
from langchain_core.messages import AIMessage, HumanMessage
|
||||
@@ -37,13 +37,15 @@ def _chat_message_history(
|
||||
# drop table if required
|
||||
if drop:
|
||||
session.execute(f"DROP TABLE IF EXISTS {keyspace}.{table_name}")
|
||||
#
|
||||
|
||||
kwargs: Any = {} if ttl_seconds is None else {"ttl_seconds": ttl_seconds}
|
||||
|
||||
return CassandraChatMessageHistory(
|
||||
session_id=session_id,
|
||||
session=session,
|
||||
keyspace=keyspace,
|
||||
table_name=table_name,
|
||||
**({} if ttl_seconds is None else {"ttl_seconds": ttl_seconds}),
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user