-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support MongoDB for custom data layer #796
Conversation
sandangel
commented
Mar 6, 2024
- fix: correct typing for _data_layer
- draft implement for mongodb data layer
Signed-off-by: San Nguyen <vinhsannguyen91@gmail.com>
Signed-off-by: San Nguyen <vinhsannguyen91@gmail.com>
@sandangel Thanks for your contribution, this is a great idea! I have some feedback:
Let me know if you have any question! |
Sure, let me revert the change in config. I will update the PR tomorrow. |
Signed-off-by: San Nguyen <vinhsannguyen91@gmail.com>
Signed-off-by: San Nguyen <vinhsannguyen91@gmail.com>
Signed-off-by: San Nguyen <vinhsannguyen91@gmail.com>
@sandangel thank you for making this! This is a great step in the right direction! One question: Can the blob storage be split from the class to give users the ability to use MongoDB in other cloud environments like Azure/Google? |
@hayescode |
hi @tpatel , I finished the mongodb custom data layer on my local and now testing. However I could not enable the chat history. Do you have any idea? |
Oh I found the issue. I need to use cl_data._data_layer instead. |
This is an excellent work 👍 I am really enthusiast of this and it would be great if Elasticsearch can be used as well You can use Elasticsearch as a vector store for RAG Assistants |
Signed-off-by: San Nguyen <vinhsannguyen91@gmail.com>
@Jimmy-Newtron If you look at the mongo_api.py, you'll see I'm using mongo client directly. We might need to have a database adapter to support different databases. Perhaps you can use elastic search for vector search and mongo db for storing chat data. Others feel free to have a look at how I handle mongo_api client to mimic literalai client. Implementing the BaseDataLayer has been very confusing because of the mapping between chainlit types and literalai types. However, since chainlit data layer only use Literal Client to interact with Literal AI, we can implement LiteralAI Client for Mongo DB instead and let chainlit handle the type mapping between chainlit and literalai. |
I'm curious to learn more about what is confusing with the types? My goal is to make sure it's smooth to implement the data layers. One thing that I've noticed in your PR is that you are inheriting a class from |
hi @tpatel . Thanks for checking. In my cases, I feel confused because lots of data types were imported from literalai and then mapped to chainlit data types. In chainlit data types, there is also a confusion for having multiple types to describe the same object. Like User/UserDict. Ideally, all the DSL should be defined in chainlit, and literalai will just import those instead. Also in base datta layer, all the methods are not clear and well designed to be implemented properly. The LiteralAI client has a better interface to implement and really straight forward. |
Closing, since our team decided to use postgres instead |