Skip to content
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

Add support for importing JSON files #110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zebfross
Copy link

@zebfross zebfross commented Jul 3, 2023

This change adds support for importing JSON files using Langchain's JSONLoader. Here are the major changes:

  • Created new routes and types in the backend-server
  • Added appropriate frontend views
  • Added HandleJsonDataSource.php that handles the uploaded files. Along with json files, I also allow zip files to be uploaded. Zip support required adding the "zip" php extension to the docker file.
  • Added jsonHandler.ts to the llm-server that imports the json files. It uses Langchain's JSONLoader to import the files as documents.

zebfross and others added 2 commits July 3, 2023 13:00
This change adds support for importing JSON files using Langchain's JSONLoader.  Here are the major changes:
- Created new routes and types in the backend-server
- Added appropriate frontend views
- Added HandleJsonDataSource.php that handles the uploaded files.   Along with json files, I also allow zip files to be uploaded.  Zip support required adding the "zip" php extension to the docker file.
- Added jsonHandler.ts to the llm-server that imports the json files.  It uses Langchain's JSONLoader to import the files as documents.
@gharbat
Copy link
Member

gharbat commented Jul 4, 2023

Wow!

Thanks for the amazing contribution! Will take a look at it tonight.

const directoryLoader = new DirectoryLoader(
'/app/shared_data/' + shared_folder,
{
'.json': (path: string | Blob) => new JSONLoader(path),
Copy link
Member

Choose a reason for hiding this comment

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

Since we are compressing the files into single .zip folder, I think we should either extract here or not compress in https://github.com/openchatai/OpenChat/pull/110/files#diff-42c70911d6785561115aeb3cbeb958a0427e6cd6fc6a84ce1ceb85ec6dbcd853R42

@inluxc
Copy link

inluxc commented Jul 27, 2023

How is this coming?
I would love to load products list.

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.

3 participants