Implementation:AGI Edgerunners LLM Agents Papers read json
| Knowledge Sources | |
|---|---|
| Domains | Data_I/O, Serialization |
| Last Updated | 2026-10-10 14:30 GMT |
Overview
Concrete utility for loading JSON files into Python dicts, provided by the LLM-Agents-Papers repository.
Description
The read_json function is a thin wrapper around Python's standard json module that opens a UTF-8 encoded JSON file, parses it into a Python dict, and returns it. It is defined identically in script_v5_step1.py, script_v5_step2.py, and download_pdf.py — each copy is a local convenience copy of the same 4-line pattern. The function is used throughout the pipeline to load seed URLs (papers_v5.json), configuration (config_v5.json), and parsed paper metadata (parsed_v5/*.json).
Usage
Import this function when you need to load any JSON-formatted data file in the pipeline:
- Loading seed arXiv URL lists (papers_v5.json)
- Loading the category taxonomy config (config_v5.json)
- Loading previously parsed paper metadata (parsed_v5/*.json)
- Loading parsed metadata for PDF batch download (parsed_v4/*.json)
Code Reference
Source Location
- Repository: LLM-Agents-Papers
- Files: script_v5_step1.py:L30-34, script_v5_step2.py:L29-33, download_pdf.py:L20-24
Signature
def read_json(file: str) -> dict:
f = open(file, 'r', encoding='utf-8')
data = json.load(f)
f.close()
return data
Import
# Each script defines its own local copy; no shared import exists.
# In script_v5_step1.py:
from script_v5_step1 import read_json
# In script_v5_step2.py:
from script_v5_step2 import read_json
# In download_pdf.py:
from download_pdf import read_json
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| file | str | Yes | Path to a UTF-8 encoded JSON file |
Outputs
| Name | Type | Description |
|---|---|---|
| return | dict | Parsed JSON content as a Python dictionary |
Usage Examples
Loading Seed URLs
# Load the seed list of arXiv URLs
papers = read_json("papers_v5.json")
for entry in papers:
url = entry.get("url", "")
code = entry.get("code")
print(f"URL: {url}, Code: {code}")
Loading Configuration
# Load category taxonomy and layout config
config = read_json("config_v5.json")
category_sort = config.get("Category_Sort", [])
description = config.get("Description", {})
Loading Parsed Paper Metadata
import os
# Iterate all parsed metadata files
parsed_folder = "parsed_v5"
for filename in os.listdir(parsed_folder):
datas = read_json(os.path.join(parsed_folder, filename))
for md5_id, paper_data in datas.items():
print(f"{paper_data.get('title')} -> {paper_data.get('pdf')}")