Normandy.LLM.Json.Scanner (normandy v1.3.0)

View Source

Byte-scanner recovery for a single JSON truncation failure mode: an unclosed top-level string at depth 1 (e.g. a vision worker's page_text payload that exhausts max_tokens mid-string). Pure; zero dependencies.

Summary

Functions

Attempt to recover a truncated payload. Returns {:ok, recovered_string} when the failure matches "unclosed top-level string at depth 1", else :error.

Functions

recover_truncated_string(content)

@spec recover_truncated_string(binary()) :: {:ok, binary()} | :error

Attempt to recover a truncated payload. Returns {:ok, recovered_string} when the failure matches "unclosed top-level string at depth 1", else :error.