wt002 commited on
Commit
d6960d4
·
verified ·
1 Parent(s): b6f660f

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +10 -2
agent.py CHANGED
@@ -420,8 +420,16 @@ class MyVector_Store:
420
  # -----------------------------
421
  # Process JSON data and create documents
422
  # -----------------------------
423
- with open("data.json", "r", encoding="utf-8") as f:
424
- data = json.load(f)
 
 
 
 
 
 
 
 
425
 
426
  docs = create_documents("json", json_data)
427
  texts = [doc.page_content for doc in docs]
 
420
  # -----------------------------
421
  # Process JSON data and create documents
422
  # -----------------------------
423
+ file_path = "/home/wendy/my_hf_agent_course_projects/src/data.json"
424
+
425
+ try:
426
+ with open(file_path, "r", encoding="utf-8") as f:
427
+ data = json.load(f)
428
+ print(data)
429
+ except FileNotFoundError as e:
430
+ print(f"Error: {e}")
431
+ except json.JSONDecodeError as e:
432
+ print(f"Error decoding JSON: {e}")
433
 
434
  docs = create_documents("json", json_data)
435
  texts = [doc.page_content for doc in docs]