mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

add add_file function to load text from file

Open gasolin opened this issue 2 years ago • 2 comments

add a handy function to load local text file (for example if you own several contents locally) instead of 2 step: load file then use add_local to pass as local strings

gasolin avatar Jun 28 '23 01:06 gasolin

@1MikeMakuch its a different thing

the add_file accept file path instead of pass string directly, after file loaded/content ready, it allow to pass text to use textLoader load content (can refer the readme in the PR)

gasolin avatar Jun 29 '23 00:06 gasolin

@gasolin Ah yes. I'm using this PR now. Thanks.

1MikeMakuch avatar Jun 29 '23 01:06 1MikeMakuch

Hey, the idea is good, but the implementation is in a different style. Please don't make it a method of the main class. Please add a loader and chunker, the loader can internally use the text loader.

cachho avatar Jul 07 '23 10:07 cachho

@cachho : should this be a separate data type? like txt file?

taranjeet avatar Aug 09 '23 06:08 taranjeet

@cachho : should this be a separate data type? like txt file?

this abstracts two lines of code. Two lines of code that would allow important customization like adding line by line or the whole text at once. So it's up to you how much abstraction you want to add, I don't think we need it.

But you are right, if we add it it has to be it's own datatype. Maybe you could even do txt_file_lines and txt_file to deal with the customization I mentioned.

cachho avatar Aug 09 '23 07:08 cachho

can you open an issue to add a new data loader called "txt".

can close this PR if not needed.

taranjeet avatar Aug 09 '23 07:08 taranjeet

opened #417 to implement this the right way. closing this.

cachho avatar Aug 09 '23 17:08 cachho