Skip to content

vllm.parser.ripple

Ricursive Ripple parser for reasoning and tool calls.

Ripple decides per turn whether to think; the generation prompt does not open <think>. Tool calls are JSON objects in Hermes-style tags::

<think>
...reasoning...
</think>
...content...
<tool_call>
{"name": "get_weather", "arguments": {"city": "Paris"}}
</tool_call>

The markers are plain text, not special tokens.

_framed(marker, before=True, after=True)

Spellings of marker with its optional framing newlines, longest first.

Source code in vllm/parser/ripple.py
def _framed(marker: str, before: bool = True, after: bool = True) -> tuple[str, ...]:
    """Spellings of ``marker`` with its optional framing newlines, longest first."""
    heads = ("\n", "") if before else ("",)
    tails = ("\n", "") if after else ("",)
    spellings = {head + marker + tail for head in heads for tail in tails}
    return tuple(sorted(spellings, key=len, reverse=True))