MCPcopy Create free account
hub / github.com/OpenManus/OpenManus-RL / save_data

Function save_data

scripts/process_tool_use_data.py:112–130  ·  view source on GitHub ↗

Save processed data to output directory

(data_splits: Dict[str, List[Dict]], output_dir: str)

Source from the content-addressed store, hash-verified

110
111
112def save_data(data_splits: Dict[str, List[Dict]], output_dir: str):
113 """Save processed data to output directory"""
114 os.makedirs(output_dir, exist_ok=True)
115
116 for split_name, split_data in data_splits.items():
117 if not split_data: # Skip empty splits
118 continue
119
120 # Save as JSON
121 json_path = os.path.join(output_dir, f"{split_name}.json")
122 with open(json_path, 'w') as f:
123 json.dump(split_data, f, indent=2, ensure_ascii=False)
124
125 # Save as Parquet (compatible with existing data format)
126 parquet_path = os.path.join(output_dir, f"{split_name}.parquet")
127 df = pd.DataFrame(split_data)
128 df.to_parquet(parquet_path, index=False)
129
130 print(f"Saved {len(split_data)} {split_name} samples to {json_path} and {parquet_path}")
131
132
133def analyze_data(data: List[Dict]):

Callers 1

mainFunction · 0.85

Calls 1

printFunction · 0.85

Tested by

no test coverage detected