ThinkR
gpt-o1 like chain of thoughts with local LLMs in R
Install / Use
/learn @CelVoxes/ThinkRREADME
thinkR

thinkR is an R package that enables o-1 like chain of thoughts using ollama.
Installation
To install thinkR, use the following command:
devtools::install_github("Celvoxes/thinkR")
Usage
Step 1: Install Ollama
Download Ollama.
Step 2: Choose Your Model
Select your preferred model. For instance, to run the Llama3 model, use the following terminal command:
ollama run llama3.1
This initiates a local server, which can be verified by visiting http://localhost:11434/. The page should display “Ollama is running”.
Step 3: Think!
Viewer
library(thinkR)
thinkr_addin()
https://github.com/user-attachments/assets/9d3ac5d6-84ad-4a9f-af28-37894a4d1ceb
API
Q: How many ’R’s are in strawberry?
library(thinkR)
## Usage example
ollama <- OllamaHandler$new(model = "llama3.1")
result <- generate_response("How many 'R's are in strawberry?", ollama)
<details>
<summary>
Thinking…
</summary>
## Step 1 : Reasoning Step
## ```json
## {
## "title": "Initial Problem Decomposition",
## "content": "The task involves counting the number of times the letter 'R' appears in the word 'strawberry'. This requires analyzing the composition and structure of the given word.",
## "confidence": 95,
## "next_action": "continue"
## }
## ```
##
## Reasoning Step 2: Approach 1 - Manual Counting
##
## ```json
## {
## "title": "Manual Counting Method",
## "content": "I will manually go through each letter in 'strawberry': S-T-R-A-W-B-E-R-R-Y. This approach involves visually identifying and counting the occurrences of 'R'.",
## "confidence": 92,
## "next_action": "continue"
## }
## ```
##
## Reasoning Step 3: Approach 2 - Pattern Recognition
##
## ```json
## {
## "title": "Pattern Recognition Method",
## "content": "Recognizing that 'strawberry' ends with a repeated sequence of letters ('R-Y'), I can infer the presence of an additional 'R'. This step leverages understanding of linguistic patterns.",
## "confidence": 88,
## "next_action": "continue"
## }
## ```
##
## Reasoning Step 4: Alternative Count Method
##
## ```json
## {
## "title": "Alternative Counting Approach",
## "content": "Considering the possibility that my initial count might be incorrect, I will re-check the word for any potential duplicates or errors
## Time: 26.6743881702423 s
##
## Step 2 : Reasoning Step
## Here's the revised response with the next step:
##
##
## ```json
## {
## "title": "Alternative Count Method Confirmation",
## "content": "Upon reviewing the word 'strawberry' again, I confirm that there are indeed two occurrences of the letter 'R', as initially counted in both the manual and pattern recognition methods.",
## "confidence": 98,
## "next_action": "final_answer"
## }
## ```
##
## Reasoning Step 5: Confidence Level Validation
##
## ```json
## {
## "title": "Confidence Level Validation",
## "content": "Given that both manual counting and pattern recognition approaches independently confirm the presence of two 'R's, I have high confidence in this answer. This validation step ensures the reliability of my reasoning chain.",
## "confidence": 99,
## "next_action": "final_answer"
## }
## ```
##
## The final answer is: $\boxed{2}$
## Time: 18.4936249256134 s
##
## Step 3 : Reasoning Step
## Here is the complete JSON response:
##
##
## ```json
## {
## "title": "Initial Problem Decomposition",
## "content": "The task involves counting the number of times the letter 'R' appears in the word 'strawberry'. This requires analyzing the composition and structure of the given word.",
## "confidence": 95,
## "next_action": "continue"
## }
## {
## "title": "Manual Counting Method",
## "content": "I will manually go through each letter in 'strawberry': S-T-R-A-W-B-E-R-R-Y. This approach involves visually identifying and counting the occurrences of 'R'.",
## "confidence": 92,
## "next_action": "continue"
## }
## {
## "title": "Pattern Recognition Method",
## "content": "Recognizing that 'strawberry' ends with a repeated sequence of letters ('R-Y'), I can infer the presence of an additional 'R'. This step leverages understanding of linguistic patterns.",
## "confidence": 88,
## "next_action": "continue"
## }
## {
## "title": "Alternative Counting Approach",
## "content": "Considering the possibility that my initial count might be incorrect, I will re-check the word for any potential duplicates or errors",
## "confidence": 85,
## "next_action": "continue"
## }
## {
## "title": "Alternative Count Method Confirmation",
## "content": "Upon reviewing the word 'strawberry' again, I
## Time: 28.58318400383 s
##
## Step 4 : Reasoning Step
## Here is the complete JSON response:
##
##
## ```json
## {
## "title": "Initial Problem Decomposition",
## "content": "The task involves counting the number of times the letter 'R' appears in the word 'strawberry'. This requires analyzing the composition and structure of the given word.",
## "confidence": 95,
## "next_action": "continue"
## }
## {
## "title": "Manual Counting Method",
## "content": "I will manually go through each letter in 'strawberry': S-T-R-A-W-B-E-R-R-Y. This approach involves visually identifying and counting the occurrences of 'R'.",
## "confidence": 92,
## "next_action": "continue"
## }
## {
## "title": "Pattern Recognition Method",
## "content": "Recognizing that 'strawberry' ends with a repeated sequence of letters ('R-Y'), I can infer the presence of an additional 'R'. This step leverages understanding of linguistic patterns.",
## "confidence": 88,
## "next_action": "continue"
## }
## {
## "title": "Alternative Counting Approach",
## "content": "Considering the possibility that my initial count might be incorrect, I will re-check the word for any potential duplicates or errors",
## "confidence": 85,
## "next_action": "continue"
## }
## {
## "title": "Alternative Count Method Confirmation",
## "content": "Upon reviewing the word 'strawberry' again, I
## Time: 30.5651700496674 s
##
## Step 5 : Reasoning Step
## Here is the complete JSON response:
##
##
## ```json
## {
## "title": "Initial Problem Decomposition",
## "content": "The task involves counting the number of times the letter 'R' appears in the word 'strawberry'. This requires analyzing the composition and structure of the given word.",
## "confidence": 95,
## "next_action": "continue"
## }
## {
## "title": "Manual Counting Method",
## "content": "I will manually go through each letter in 'strawberry': S-T-R-A-W-B-E-R-R-Y. This approach involves visually identifying and counting the occurrences of 'R'.",
## "confidence": 92,
## "next_action": "continue"
## }
## {
## "title": "Pattern Recognition Method",
## "content": "Recognizing that 'strawberry' ends with a repeated sequence of letters ('R-Y'), I can infer the presence of an additional 'R'. This step leverages understanding of linguistic patterns.",
## "confidence": 88,
## "next_action": "continue"
## }
## {
## "title": "Alternative Counting Approach",
## "content": "Considering the possibility that my initial count might be incorrect, I will re-check the word for any potential duplicates or errors",
## "confidence": 85,
## "next_action": "continue"
## }
## {
## "title": "Alternative Count Method Confirmation",
## "content": "Upon reviewing the word 'strawberry' again, I
## Time: 31.5878710746765 s
##
## Step 6 : Reasoning Step
## Here is the complete JSON response:
##
##
## ```json
## {
## "title": "Initial Problem Decomposition",
## "content": "The task involves counting the number of times the letter 'R' appears in the word 'strawberry'. This requires analyzing the composition and structure of the given word.",
## "confidence": 95,
## "next_action": "continue"
## }
## {
## "title": "Manual Counting Method",
## "content": "I will manually go through each letter in 'strawberry': S-T-R-A-W-B-E-R-R-Y. This approach involves visually identifying and counting the occurrences of 'R'.",
## "confidence": 92,
## "next_action": "continue"
## }
## {
## "title": "Pattern Recognition Method",
## "content": "Recognizing that 'strawberry' ends with a repeated sequence of letters ('R-Y'), I can infer the presence of an additional 'R'. This step leverages understanding of linguistic patterns.",
## "confidence": 88,
## "next_action": "continue"
## }
## {
## "title": "Alternative Counting Approach",
## "content": "Considering the possibility that my initial count might be incorrect, I will re-check the word for any potential duplicates or errors",
## "confidence": 85,
## "next_action": "continue"
## }
## {
## "title": "Alternative Count Method Confirmation",
## "content": "Upon reviewing the word 'strawberry' again, I
## Time: 32.4799299240112 s
##
## Step 7 : Reasoning Step
## It seems like you are sharing a JSON response that contains multiple "steps" or approaches to solving a problem.
##
## To answer your question directly: The step that leverages understanding of linguistic patterns is mentioned in th
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
