-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
82 lines (55 loc) · 1.79 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
title: "thinkR"
output: github_document
---
![](logo.webp)
thinkR is an R package that enables o-1 like chain of thoughts using ollama.
## Installation
To install ceLLama, use the following command:
```{r eval=FALSE}
devtools::install_github("eonurk/thinkR")
```
## Usage
#### Step 1: Install Ollama
Download [`Ollama`](https://ollama.com/).
#### Step 2: Choose Your Model
Select your preferred model. For instance, to run the Llama3 model, use the following terminal command:
```{bash eval=FALSE}
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!
> Q: How many 'R's are in strawberry?
```{r cache=TRUE, eval=FALSE}
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>
```{r echo=FALSE}
result <- readRDS("llama3_1.results.rds")
cat(paste0(
sapply(result$steps, function(m) {
if (!is.null(m$title) && !is.null(m$content) && !is.null(m$thinking_time)) {
sprintf("%s\n%s\nTime: %s s\n\n", m$title, m$content, m$thinking_time)
}
}, USE.NAMES = FALSE)
))
```
</details>
```{r echo=FALSE}
total_thinking_time <- result$total_thinking_time
cat(paste0("Total thinking time: ", sprintf("%.2f", total_thinking_time), " s"))
```
> A: Therefore, the final answer is 3!
<br>
> [!NOTE]\
> This output is cherry-picked from llama3.1... because 70b was a lot to download for my internet connection.
## Acknowledgments
Cursor is a great tool <3
### Credits
- [g-1](https://github.com/bklieger-groq/g1)
- [multi-1](https://github.com/tcsenpai/multi1)
## License
This project is licensed under the MIT License