parse_post_prompt_data
parse_post_prompt_data
Return post_prompt_data as a plain dict, whichever shape it arrived in:
- A
{"parsed": {...}}or{"parsed": [ {...} ]}wrapper is unwrapped first. - A flat object with real keys is returned as-is, minus
rawandparsed. - A
{"raw": "..."}string is unfenced withstrip_json_fence()and parsed as JSON. Prose that isn’t JSON becomes{"summary": "<the prose>"}.
Never raises. A malformed summary degrades to {} rather than failing the request that
delivered it.
Parameters
data
The post_prompt_data value from a post-prompt body.
Returns
dict[str, Any] — The summary object, or {} when there is nothing usable.
Example
Part of the post-prompt normalization module.