Skip to content

Conversation

@michaelsembwever
Copy link
Contributor

@michaelsembwever michaelsembwever commented May 11, 2025

Time-series each chat window in Cassandra, keeping past (and deleted) windows still in the db. Add ability to store different MessageTypes.

ref: #2998

@michaelsembwever michaelsembwever force-pushed the mck/CassandraChatMemoryRepository_0 branch 2 times, most recently from af0c80d to a5649da Compare May 11, 2025 19:38
…age pattern

Time-series each chat window in Cassandra, keeping past (and deleted) windows still in the db.
Add ability to store different MessageTypes.

Signed-off-by: mck <[email protected]>
@michaelsembwever michaelsembwever force-pushed the mck/CassandraChatMemoryRepository_0 branch from a5649da to 73e31d1 Compare May 11, 2025 19:42
@michaelsembwever michaelsembwever marked this pull request as ready for review May 11, 2025 19:42
stmt = stmt.whereColumn(columnName).isEqualTo(QueryBuilder.bindMarker(columnName));
private Message getMessage(UdtValue udt) {
String content = udt.getString(this.conf.messageUdtContentColumn);
Map<String, Object> props = Map.of(CONVERSATION_TS, udt.getInstant(this.conf.messageUdtTimestampColumn));
Copy link
Contributor Author

@michaelsembwever michaelsembwever May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZYMCao messages have the timestamp value in their metadata, as an Instant instance, under the CONVERSATION_TS key.

The literal for that key is found here: https://github.com/spring-projects/spring-ai/blob/main/memory/spring-ai-model-chat-memory-cassandra/src/main/java/org/springframework/ai/chat/memory/cassandra/CassandraChatMemoryRepository.java#L50-L51

Copy link

@ZYMCao ZYMCao May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelsembwever
unix timestamp is great, but I am not sure about fraction part:

[
{
"messageType": "USER",
"metadata": {
"CassandraChatMemoryRepository_message_timestamp": 1747564565.737000000,
"messageType": "USER"
},
"media": [],
"text": "SSE development using springboot?"
},
{
"messageType": "ASSISTANT",
"metadata": {
"CassandraChatMemoryRepository_message_timestamp": 1747564594.962000000,
"messageType": "ASSISTANT"
},
"toolCalls": [],
"media": [],
"text": "..."
}
]

@ilayaperumalg ilayaperumalg self-assigned this May 12, 2025
@markpollack markpollack added this to the 1.0.0-RC1 milestone May 13, 2025
@ilayaperumalg
Copy link
Member

@michaelsembwever Thanks for the PR! Rebased and merged as 87b680a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants