Skip to content

Create MongoDB chat memory implementation #2679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deejay1
Copy link
Contributor

@deejay1 deejay1 commented Apr 9, 2025

This is the initial implementation of a stock MongoDB chat memory which doesn't require MongoDB Atlas

Closes #2688

@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch from 2d88035 to 76752cf Compare April 10, 2025 12:47
@deejay1 deejay1 marked this pull request as ready for review April 10, 2025 12:48
yield null;
}
};
}
Copy link

Choose a reason for hiding this comment

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

indentation is not consistent, some files have 2 tabs and some have 4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, I ran spring-javaformat on it, seems like it doesn't take care of that :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whenever I change the formatting, javaformat brings me back to these versions.

Copy link

@xchopin xchopin Apr 11, 2025

Choose a reason for hiding this comment

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

change the settings in your IDE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hope it's better now ?

@deejay1 deejay1 requested a review from xchopin April 11, 2025 08:42
@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch from 8321e4d to 14375f0 Compare April 14, 2025 09:49
@deejay1 deejay1 requested review from xchopin and eddumelendez April 14, 2025 09:50
@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch 2 times, most recently from 290cacf to 78ad992 Compare April 16, 2025 07:44
@Amine-Kadi
Copy link

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)

@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch 2 times, most recently from 249380d to e483254 Compare April 17, 2025 14:25
@deejay1
Copy link
Contributor Author

deejay1 commented Apr 17, 2025

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)

Good idea to keep it in sync. Implemented

@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch from e483254 to 44d84c2 Compare April 17, 2025 14:26
@deejay1
Copy link
Contributor Author

deejay1 commented Apr 21, 2025

This will probably be reimplemented tomorrow atop of #2803

@ThomasVitale
Copy link
Contributor

@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: #2890

@deejay1
Copy link
Contributor Author

deejay1 commented Apr 26, 2025

@ThomasVitale sure, I'll rewrite it of course!

@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch 2 times, most recently from f3d3324 to 73ea405 Compare April 28, 2025 11:00
@deejay1
Copy link
Contributor Author

deejay1 commented Apr 28, 2025

@ThomasVitale ok, rewritten into a ChatMemoryRepository implementation

@deejay1 deejay1 requested a review from Amine-Kadi April 28, 2025 11:01
@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch 2 times, most recently from 68c5cfc to 71e7584 Compare May 5, 2025 08:34
@deejay1
Copy link
Contributor Author

deejay1 commented May 5, 2025

@ThomasVitale any chances to get it in before 1.0.0?

@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch 2 times, most recently from a5081dd to 451790f Compare May 12, 2025 09:42
@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch from 451790f to 98b52eb Compare May 12, 2025 10:02
@deejay1
Copy link
Contributor Author

deejay1 commented May 12, 2025

Updated to latest changes

@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch 6 times, most recently from 3cbddac to d491b5e Compare May 16, 2025 19:06
@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch 2 times, most recently from e50f396 to 434a168 Compare May 22, 2025 10:49
@deejay1
Copy link
Contributor Author

deejay1 commented May 26, 2025

@xchopin @eddumelendez Could you take a look again?

@deejay1 deejay1 force-pushed the mongo-db-chat-memory branch from 434a168 to 38a333c Compare May 30, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create MongoDB chat memory
5 participants