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:
54
54
"""
55
55
56
56
fetch_node = FetchNode (
57
- input = "json_dir " ,
57
+ input = "json " ,
58
58
output = ["doc" ],
59
59
)
60
60
parse_node = ParseNode (
@@ -106,4 +106,4 @@ def run(self) -> str:
106
106
inputs = {"user_prompt" : self .prompt , self .input_key : self .source }
107
107
self .final_state , self .execution_info = self .graph .execute (inputs )
108
108
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 2
2
FetchNode Module
3
3
"""
4
4
import pandas as pd
5
+ import json
5
6
from typing import List , Optional
6
7
from langchain_community .document_loaders import AsyncChromiumLoader
7
8
from langchain_core .documents import Document
@@ -75,8 +76,13 @@ def execute(self, state):
75
76
compressed_document = loader .load ()
76
77
77
78
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"
80
86
})]
81
87
elif self .input == "xml" :
82
88
with open (source , 'r' , encoding = 'utf-8' ) as f :
You can’t perform that action at this time.
0 commit comments