> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# normalize_post_prompt

> Normalize a post-prompt body from the voice or chat engine into one shape.

[ref-post-prompt]: /docs/server-sdks/reference/python/core/post-prompt

[parse]: /docs/server-sdks/reference/python/core/post-prompt/parse-post-prompt-data

[dialogue]: /docs/server-sdks/reference/python/core/post-prompt/dialogue-turns

Normalize a post-prompt body from either engine. Parses `post_prompt_data` with
[`parse_post_prompt_data()`][parse], reads the log from `call_log`, `raw_call_log`, or
`raw_messages`, and extracts the dialogue with [`dialogue_turns()`][dialogue], dropping the chat
engine's summary echo by comparing against the raw summary string.

## Parameters

**`body`** `Any` — required

The complete post-prompt request body.

---

## Returns

[`NormalizedPostPrompt`][ref-post-prompt] -- Never raises. A body the function can't make sense of
yields one with empty fields.

## Example

```python {3}
from signalwire.core.post_prompt import normalize_post_prompt

leg = normalize_post_prompt(raw_body)
if leg.dialogue:
    store(leg.conversation_id, leg.medium, leg.summary, leg.dialogue)
```