File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def _create_graph(self) -> BaseGraph:
5454 """
5555
5656 fetch_node = FetchNode (
57- input = "json_dir " ,
57+ input = "json " ,
5858 output = ["doc" ],
5959 )
6060 parse_node = ParseNode (
@@ -106,4 +106,4 @@ def run(self) -> str:
106106 inputs = {"user_prompt" : self .prompt , self .input_key : self .source }
107107 self .final_state , self .execution_info = self .graph .execute (inputs )
108108
109- return self .final_state .get ("answer" , "No answer found." )
109+ return self .final_state .get ("answer" , "No answer found." )
Original file line number Diff line number Diff line change 22FetchNode Module
33"""
44import pandas as pd
5+ import json
56from typing import List , Optional
67from langchain_community .document_loaders import AsyncChromiumLoader
78from langchain_core .documents import Document
@@ -75,8 +76,13 @@ def execute(self, state):
7576 compressed_document = loader .load ()
7677
7778 elif self .input == "csv" :
78- compressed_document = [Document (page_content = pd .read_csv (source ), metadata = {
79- "source" : "xml"
79+ compressed_document = [Document (page_content = str (pd .read_csv (source )), metadata = {
80+ "source" : "csv"
81+ })]
82+ elif self .input == "json" :
83+ f = open (source )
84+ compressed_document = [Document (page_content = str (json .load (f )), metadata = {
85+ "source" : "json"
8086 })]
8187 elif self .input == "xml" :
8288 with open (source , 'r' , encoding = 'utf-8' ) as f :
You can’t perform that action at this time.
0 commit comments