yeonmorae commited on
Commit
10e8db7
ยท
1 Parent(s): 0e4c374
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -50,7 +50,6 @@ def get_csv_file(docs):
50
  csv_doc = csv_loader.load() # ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
51
  return csv_doc # ์ถ”์ถœํ•œ ํ…์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
52
 
53
-
54
  def get_json_file(docs):
55
  temp_dir = tempfile.TemporaryDirectory()
56
  temp_filepath = os.path.join(temp_dir.name, docs.name)
@@ -58,17 +57,15 @@ def get_json_file(docs):
58
  f.write(docs.getvalue())
59
  json_loader = JSONLoader(temp_filepath)
60
  json_data = json_loader.load()
61
-
62
- json_spec = JsonSpec(dict_=json_data, max_value_length=4000)
63
- json_toolkit = JsonToolkit(spec=json_spec)
64
- json_agent_executor = create_json_agent(
65
- llm=OpenAI(temperature=0),
66
- toolkit=json_toolkit,
67
- verbose=True
68
- )
69
- json_doc = json_agent_executor.execute(text=temp_filepath)
70
-
71
- return json_doc
72
 
73
  # ๋ฌธ์„œ๋“ค์„ ์ฒ˜๋ฆฌํ•˜์—ฌ ํ…์ŠคํŠธ ์ฒญํฌ๋กœ ๋‚˜๋ˆ„๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
74
  def get_text_chunks(documents):
 
50
  csv_doc = csv_loader.load() # ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
51
  return csv_doc # ์ถ”์ถœํ•œ ํ…์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
52
 
 
53
  def get_json_file(docs):
54
  temp_dir = tempfile.TemporaryDirectory()
55
  temp_filepath = os.path.join(temp_dir.name, docs.name)
 
57
  f.write(docs.getvalue())
58
  json_loader = JSONLoader(temp_filepath)
59
  json_data = json_loader.load()
60
+ # json_spec = JsonSpec(dict_=json_data, max_value_length=4000)
61
+ # json_toolkit = JsonToolkit(spec=json_spec)
62
+ # json_agent_executor = create_json_agent(
63
+ # llm=OpenAI(temperature=0),
64
+ # toolkit=json_toolkit,
65
+ # verbose=True
66
+ # )
67
+ # json_doc = json_agent_executor.execute(text=temp_filepath)
68
+ return json_data
 
 
69
 
70
  # ๋ฌธ์„œ๋“ค์„ ์ฒ˜๋ฆฌํ•˜์—ฌ ํ…์ŠคํŠธ ์ฒญํฌ๋กœ ๋‚˜๋ˆ„๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
71
  def get_text_chunks(documents):