Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I kept hitting jq: parse error on AI streams, so I built sjq

Описание и применение

sjq — это CLI‑утилита, которая парсит сервер‑передаваемые события от LLM‑моделей, выводя каждое событие в читаемом виде с метриками времени, заменяя громоздкие JSON‑оболочки.

Задача

Parsing OpenAI-compatible server‑sent event streams with jq fails because the stream is not JSON.

Результат

sjq transforms noisy SSE envelopes into readable, delta‑focused lines with timing metrics, improving debugging and monitoring of LLM streams.

Рабочий процесс

  • 1. Install sjq via Homebrew or cargo.
  • 2. Run sjq curl -s $BASE/v1/chat/completions -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"model":"gemini-4-argon","stream":true,"messages":[{"role":"user","content":"hi"}]}'
  • 3. Observe per‑event output lines with content, timing, and labels.
  • 4. Use output for debugging provider latency or content inspection.

Доказательства

jq: parse error: Invalid numeric literal at line 1, column 9

Источник

sjq — jq, but for AI streaming. A small Rust CLI that parses OpenAI-compatible server-sent event streams and prints one short line per event, showing only what each event added.

Источник

Instead of 99% envelope JSON, you watch the actual content arrive — plus a timing line: TTFT, total, tokens/sec.

Источник

brew tap vivgrid/tap brew trust vivgrid/tap # Homebrew 6+ requires trusting third‑party taps brew install sjq

Источник

Or from source: cargo install --git https://github.com/vivgrid/sjq (one dependency: serde_json).

Источник

  • Дата записи: 2026-10-16T01:41:16.737Z