Module parse

Module parse 

Source
Expand description

Complete-message parsing and embedding of thinking content.

These functions work on full (non-streaming) messages. For streaming, see super::ThinkingAccumulator.

Functionsยง

embed_thinking_content
Embed thinking content into a message using canonical <think> tags.
find_ci ๐Ÿ”’
Case-insensitive find.
format_thinking_duration
Format a duration for human display.
has_thinking_content
Lightweight check for whether text begins with a thinking tag.
parse_duration_attr ๐Ÿ”’
Extract the duration attribute value from a tag attribute string.
parse_open_tag_attrs ๐Ÿ”’
Parse the attribute section of an opening <think ...> tag. Input should be the text after <think and before/including >. Returns (duration_option, rest_after_closing_bracket).
parse_thinking_content
Parse thinking content from a complete message.
strip_prefix_ci ๐Ÿ”’
Case-insensitive prefix strip: if text starts with prefix (case-insensitive), returns the rest of text (preserving original case).