Think Split Plugin is a plugin designed to handle thinking processes in AI model responses. It automatically identifies and separates <think> tag content in responses, extracting the thinking process from the main answer into a separate reasoning_content field, allowing AI's thinking process and final answer to be displayed and processed separately.
- Automatic Recognition: Automatically detects
<think>...</think>tags in responses - Content Separation: Extracts thinking content to
reasoning_contentfield - Streaming Support: Supports both streaming and non-streaming response processing
- Zero Intrusion: Doesn't affect original response structure, only adds new fields
- High Performance: Uses efficient KMP algorithm for pattern matching
The plugin recognizes thinking content in the following formats:
<think>
AI's thinking process here...
</think>
or
\n<think>
AI's thinking process here...
</think>\n
Before:
{
"choices": [{
"message": {
"content": "\n<think>\nThis is a math question...\n</think>\nThe answer is 42."
}
}]
}After:
{
"choices": [{
"message": {
"content": "The answer is 42.",
"reasoning_content": "This is a math question..."
}
}]
}{
"model": "gpt-4",
"type": 1,
"plugin": {
"think-split": {
"enable": true
}
}
}{
"model": "claude-3-opus",
"type": 1,
"retry_times": 3,
"plugin": {
"think-split": {
"enable": true
}
}
}| Field | Type | Required | Default | Description |
|---|---|---|---|---|
enable |
bool | Yes | false | Whether to enable Think Split plugin |
Think Split Plugin can work together with other plugins:
{
"model": "gpt-4",
"plugin": {
"think-split": {
"enable": true
},
"cache": {
"enable": true,
"ttl": 300
},
"web-search": {
"enable": true
}
}
}- Performance Impact: The plugin uses efficient KMP algorithm with minimal performance impact
- Content Integrity: Ensure
<think>tags are properly closed, otherwise recognition may fail - Nested Handling: Nested
<think>tags are not supported - Field Conflicts: If original response already contains
reasoning_contentfield, it will be overwritten
- Check if
enableis set totrue - Confirm model configuration is loaded correctly
- Verify response actually contains
<think>tags
- Check if
<think>tag format is correct - Confirm tags are properly closed
- Check logs for error messages
- Confirm client properly handles streaming responses
- Check if SSE format is parsed correctly
- Verify
reasoning_contentfield is in delta
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-4",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum entanglement is a phenomenon in quantum mechanics...",
"reasoning_content": "The user is asking about quantum entanglement, which is a core concept in quantum physics..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4","choices":[{"index":0,"delta":{"reasoning_content":"Starting to think about the problem..."},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4","choices":[{"index":0,"delta":{"content":"Quantum entanglement is"},"finish_reason":null}]}
data: [DONE]