def doc

bend-kit-llm@0.13.0.1 · llm.bend:153

import bend-kit-llm@0.13.0.1/llm.bend as Llm
import Base
import bend-kit-json@0.7.0.0/json.bend as Json
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

153# Every non-null leaf of a JSON text in document order, keyed by its path, as ("content.0.text", "Hi").
154# Strings are decoded; numbers keep their text. None when b is not JSON. Each value takes a byte, so n + 1 steps suffice.
155def doc(b: Bytes.Bytes) -> Maybe<&2, List<&2, Leaf>>:
156  Bytes.Bytes{+n, buf} = b
157  doc.of(n, Json.parse.bytes(Bytes.Bytes{n, buf}))

Uses (6)

Used by (3)