Skip to content
1 min read · 130 words

Function: resolveReasoningParser()

ts
function resolveReasoningParser(
  option: ReasoningParserName | ReasoningParserFn | undefined,
  parsers?: Partial<
    Record<Exclude<ReasoningParserName, "auto" | "none">, ReasoningParserFn>
  >,
  opts?: ReasoningParserOptions,
): ReasoningParserFn;

Defined in: src/batteries/llm/chat_common/reasoning_parsers.ts:335

Resolve a reasoningParser option (a name, 'auto', 'none', or a custom fn) to a concrete ReasoningParserFn.

Parameters

ParameterTypeDefault valueDescription
option| ReasoningParserName | ReasoningParserFn | undefinedundefinedThe option value. Defaults to 'auto' when undefined.
parsersPartial<Record<Exclude<ReasoningParserName, "auto" | "none">, ReasoningParserFn>>BUNDLED_REASONING_PARSERSOverride the bundled parsers. Ignored when opts.orphanRecovery is set (the bundled family parsers are rebuilt with that setting); pass a custom option fn for full control.
optsReasoningParserOptions{}ReasoningParserOptions; orphanRecovery defaults to true. When false, the named/auto bundled parsers are rebuilt in strict pair-only mode.

Returns

ReasoningParserFn