2025-01-09 16:47:37 -03:00
|
|
|
import json
|
2024-11-01 18:07:08 -03:00
|
|
|
from pathlib import Path
|
2025-01-09 16:47:37 -03:00
|
|
|
from typing import List, Dict, Any
|
2024-11-01 18:07:08 -03:00
|
|
|
|
|
|
|
|
|
|
|
def shared_volume() -> Path:
|
2024-12-14 06:34:11 -03:00
|
|
|
return Path(__file__).parent.parent.parent.joinpath("volume")
|
|
|
|
|
2024-12-11 13:52:55 -03:00
|
|
|
|
|
|
|
def compact(a_string: str) -> str:
|
2024-12-14 06:34:11 -03:00
|
|
|
return "\n".join([line.strip() for line in a_string.splitlines() if line.strip()])
|
2025-01-09 16:47:37 -03:00
|
|
|
|
|
|
|
|
|
|
|
def make_jsonl(content: List[Dict[str, Any]]) -> str:
|
|
|
|
return "\n".join([json.dumps(line, separators=(",", ":")) for line in content])
|