close
Skip to main content

Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score100%
Downloads3/wk
Publisheda year ago (0.1.1)

Parse think process of LLMs like DeepSeek-R1 and return the clean result and the think process.

ParseThink

Parse think process of LLMs like DeepSeek-R1 and return the clean result and the think process.

JSR Scope JSR Version JSR Score

Usage

import OpenAI from 'npm:openai'
import parse from 'jsr:@leaf/parse-think'

const ai = new OpenAI({
  baseUrl: 'https://api.deepseek.com/v1',
  apiKey: '<YOUR_API_KEY>',
})
const res = await ai.chat.completions.create({
  model: 'deepseek-reasoner',
  messages: [
    { role: 'user', content: 'What is the result of 2 + 2 * 2?' },
  ],
})
const { content, think } = parse(res.choices[0].message)
console.log('Content:', content)
console.log('Think:', think)
Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@leaf/parse-think

Import symbol

import parse_think from "@leaf/parse-think";
or

Import directly with a jsr specifier

import parse_think from "jsr:@leaf/parse-think";