spring-ai
spring-ai copied to clipboard
Create MongoDB chat memory implementation
This is the initial implementation of a stock MongoDB chat memory which doesn't require MongoDB Atlas
Closes #2688
I feel like it could be better to have only Mongo instead of MongoDb in all classes names.
For example : MongoDbChatMemoryProperties.java could be named MongoChatMemoryPropoerties.java.
It would follow the same logic as all classes in org.springframework.data.mongodb (MongoTemplate and not MongoDbTemplate)
I feel like it could be better to have only Mongo instead of MongoDb in all classes names. For example :
MongoDbChatMemoryProperties.javacould be namedMongoChatMemoryPropoerties.java.It would follow the same logic as all classes in org.springframework.data.mongodb (MongoTemplate and not MongoDbTemplate)
Good idea to keep it in sync. Implemented
This will probably be reimplemented tomorrow atop of https://github.com/spring-projects/spring-ai/pull/2803
@deejay1 thanks so much for your contribution! We have just delivered some changes to the ChatMemory API which include the introduction of a ChatMemoryRepository API to separate the two different concerns: memory management strategy and storage mechanism. For example, the JdbcChatMemory has now been superseded by JdbcChatMemoryRepository. It would be great if we could use the new approach directly for MongoDB. What do you think?
Upgrade Notes: https://docs.spring.io/spring-ai/reference/upgrade-notes.html#_chat_memory New Chat Memory Docs: https://docs.spring.io/spring-ai/reference/api/chat-memory.html PR with the change: https://github.com/spring-projects/spring-ai/pull/2890
@ThomasVitale sure, I'll rewrite it of course!
@ThomasVitale ok, rewritten into a ChatMemoryRepository implementation
@ThomasVitale any chances to get it in before 1.0.0?
Updated to latest changes
@xchopin @eddumelendez Could you take a look again?
@xchopin any update on getting this merged? I am kinda blocked on this.
Would be nice to have this feature in 1.1.0
@markpollack Can I bump this a little? ;)
@ilayaperumalg any chances this also gets merged? we're using it successfully in prod for a while now (since April to be exact ;)
This is great and would help a ton - any chance to get this in soon? @markpollack
@deejay1 It seems like you write the metadata information, but doesn't seem to restore it upon read. Is that intentional? Also how about throwing an IllegalStateException for unsupported message types?
Merged on main as 80527b26 for inclusion in 1.1.0
@sobychacko please create issues related to your above comment if you feel like they're relevant.
Thanks everyone for this high quality contribution.
@sobychacko You're right, I've implemented this here https://github.com/spring-projects/spring-ai/pull/4830