Vllm.Reasoning.ReasoningParserManager (VLLM v0.3.0)

Copy Markdown View Source

Central registry for ReasoningParser implementations.

Supports two registration modes:

  • Eager registration via register_module
  • Lazy registration via register_lazy_module

Each reasoning parser must inherit from ReasoningParser.

Summary

Functions

Import and register a lazily loaded reasoning parser.

Register a ReasoningParser class immediately.

Retrieve a registered or lazily registered ReasoningParser class.

Import a user-defined reasoning parser by the path

Return names of all eagerly and lazily registered reasoning parsers.

Initialize self. See help(type(self)) for accurate signature.

Register a lazy module mapping for delayed import.

Register module with the given name or name list. it can be used as a

Types

t()

@opaque t()

Functions

_load_lazy_parser(ref, name, opts \\ [])

@spec _load_lazy_parser(SnakeBridge.Ref.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Import and register a lazily loaded reasoning parser.

Parameters

  • name (String.t())

Returns

  • term()

_register_module(ref, module, args, opts \\ [])

@spec _register_module(SnakeBridge.Ref.t(), term(), [term()], keyword()) ::
  {:ok, nil} | {:error, Snakepit.Error.t()}

Register a ReasoningParser class immediately.

Parameters

  • module (term())
  • module_name (term() default: None)
  • force (boolean() default: True)

Returns

  • nil

get_reasoning_parser(ref, name, opts \\ [])

@spec get_reasoning_parser(SnakeBridge.Ref.t(), String.t(), keyword()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Retrieve a registered or lazily registered ReasoningParser class.

If the parser is lazily registered, it will be imported and cached on first access.

Raises

  • KeyError - if no parser is found under the given name.

Parameters

  • name (String.t())

Returns

  • term()

import_reasoning_parser(ref, plugin_path, opts \\ [])

@spec import_reasoning_parser(SnakeBridge.Ref.t(), String.t(), keyword()) ::
  {:ok, nil} | {:error, Snakepit.Error.t()}

Import a user-defined reasoning parser by the path

of the reasoning parser define file.

Parameters

  • plugin_path (String.t())

Returns

  • nil

lazy_parsers(ref)

@spec lazy_parsers(SnakeBridge.Ref.t()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

list_registered(ref, opts \\ [])

@spec list_registered(
  SnakeBridge.Ref.t(),
  keyword()
) :: {:ok, [String.t()]} | {:error, Snakepit.Error.t()}

Return names of all eagerly and lazily registered reasoning parsers.

Returns

  • list(String.t())

new(args, opts \\ [])

@spec new(
  [term()],
  keyword()
) :: {:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()}

Initialize self. See help(type(self)) for accurate signature.

Parameters

  • args (term())
  • kwargs (term())

reasoning_parsers(ref)

@spec reasoning_parsers(SnakeBridge.Ref.t()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

register_lazy_module(ref, name, module_path, class_name, opts \\ [])

@spec register_lazy_module(
  SnakeBridge.Ref.t(),
  String.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, nil} | {:error, Snakepit.Error.t()}

Register a lazy module mapping for delayed import.

Examples

ReasoningParserManager.register_lazy_module(
name="qwen3",
module_path="vllm.reasoning.parsers.qwen3_reasoning_parser",
class_name="Qwen3ReasoningParser",
)

Parameters

  • name (String.t())
  • module_path (String.t())
  • class_name (String.t())

Returns

  • nil

register_module(ref, args, opts \\ [])

@spec register_module(SnakeBridge.Ref.t(), [term()], keyword()) ::
  {:ok, term()} | {:error, Snakepit.Error.t()}

Register module with the given name or name list. it can be used as a

decoder(with module as None) or normal function(with module as not None).

Parameters

  • name (term() default: None)
  • force (boolean() default: True)
  • module (term() default: None)

Returns

  • term()