Utils
Reasoning
npm i @xsai/utils-reasoningExamples
extractReasoning
extracts XML-tagged reasoning sections from text.
import { } from '@xsai/generate-text'
import { } from '@xsai/utils-reasoning'
import { } from 'node:process'
const { : } = await ({
: 'http://localhost:11434/v1/',
: [
{
: 'You\'re a helpful assistant.',
: 'system'
},
{
: 'Why is the sky blue?',
: 'user'
},
],
: 'qwen3',
})
const { , } = (!) extractReasoningStream
extracts XML-tagged reasoning sections from text stream.
import { } from '@xsai/stream-text'
import { } from '@xsai/utils-reasoning'
import { } from 'node:process'
const { : } = ({
: 'http://localhost:11434/v1/',
: [
{
: 'You\'re a helpful assistant.',
: 'system'
},
{
: 'Why is the sky blue?',
: 'user'
},
],
: 'qwen3',
})
const { , } = () 