You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.44.7
3
+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.44.8
4
4
## Usage
5
5
```bash
6
6
ollama_eval "task"# generate command with random model
@@ -13,13 +13,10 @@ oe "task" "model" # alias for ollama_eval
13
13
14
14
```
15
15
16
-
Ollama Eval - make a pretty screensaver in bash
17
-
Using model: gpt-oss:20b
16
+
gpt-oss:20b generated the command:
18
17
19
-
Generated Command:
20
-
while true; do clear; tput cup $((RANDOM%23)) $((RANDOM%80)); echo -e "\e[34m◉\e[0m"; sleep .2; done
18
+
while true; do tput clear; for i in $(seq 1 200); do tput cup $((RANDOM%24)) $((RANDOM%80)); printf "\e[38;5;${RANDOM%256}m%s\e[0m" "$(tr -dc 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' < /dev/urandom | head -c1)"; done; sleep .05; done
21
19
22
-
Safety & Syntax Check:
23
20
✅ Valid start: while
24
21
✅ Valid Bash Syntax
25
22
✅ No dangerous commands found
@@ -32,13 +29,10 @@ Run command in sandbox (y/N/eval)? Aborted.
32
29
33
30
```
34
31
35
-
Ollama Eval - show me all shell files in current directory
36
-
Using model: gpt-oss:20b
32
+
gpt-oss:20b generated the command:
37
33
38
-
Generated Command:
39
-
find . -maxdepth 1 -type f -name "*.sh"
34
+
find . -maxdepth 1 -type f -name '*.sh' -printf '%f\n'
40
35
41
-
Safety & Syntax Check:
42
36
✅ Valid start: find
43
37
✅ Valid Bash Syntax
44
38
⚠️ WARNING: The generated command contains a potentially dangerous token: "."
@@ -51,13 +45,10 @@ Run command in sandbox (y/N/eval)? Aborted.
51
45
52
46
```
53
47
54
-
Ollama Eval - find files larger than 1GB
55
-
Using model: gpt-oss:20b
48
+
gpt-oss:20b generated the command:
56
49
57
-
Generated Command:
58
-
find . -type f -size +1G
50
+
find . -type f -size +1G
59
51
60
-
Safety & Syntax Check:
61
52
✅ Valid start: find
62
53
✅ Valid Bash Syntax
63
54
⚠️ WARNING: The generated command contains a potentially dangerous token: "."
@@ -70,16 +61,13 @@ Run command in sandbox (y/N/eval)? Aborted.
70
61
71
62
```
72
63
73
-
Ollama Eval - what version of bash am I using?
74
-
Using model: gpt-oss:120b
64
+
gpt-oss:20b generated the command:
75
65
76
-
Generated Command:
77
-
bash --version
66
+
echo "$BASH_VERSION"
78
67
79
-
Safety & Syntax Check:
80
-
✅ Valid start: bash
68
+
✅ Valid start: echo
81
69
✅ Valid Bash Syntax
82
-
⚠️ WARNING: The generated command contains a potentially dangerous token: "bash"
70
+
✅ No dangerous commands found
83
71
84
72
Run command in sandbox (y/N/eval)? Aborted.
85
73
@@ -89,14 +77,11 @@ Run command in sandbox (y/N/eval)? Aborted.
89
77
90
78
```
91
79
92
-
Ollama Eval - am I on windows, mac, linux, or what?
93
-
Using model: gpt-oss:120b
80
+
gpt-oss:20b generated the command:
94
81
95
-
Generated Command:
96
-
case "$(uname -s)" in CYGWIN*|MINGW*|MSYS*) echo "Windows";; Darwin) echo "macOS";; Linux) echo "Linux";; *) echo "Other";; esac
82
+
if [[ "$(uname -s)" == CYGWIN* ]]; then echo Windows; elif [[ "$(uname -s)" == Darwin ]]; then echo macOS; elif [[ "$(uname -s)" == Linux ]]; then echo Linux; else echo "$(uname -s)"; fi
97
83
98
-
Safety & Syntax Check:
99
-
✅ Valid start: case
84
+
✅ Valid start: if
100
85
✅ Valid Bash Syntax
101
86
✅ No dangerous commands found
102
87
@@ -108,14 +93,11 @@ Run command in sandbox (y/N/eval)? Aborted.
108
93
109
94
```
110
95
111
-
Ollama Eval - get system load
112
-
Using model: gpt-oss:20b
96
+
gpt-oss:20b generated the command:
113
97
114
-
Generated Command:
115
-
uptime
98
+
uptime
116
99
117
-
Safety & Syntax Check:
118
-
❌ Invalid start: uptime.
100
+
❌ Invalid start: uptime
119
101
120
102
```
121
103
@@ -130,16 +112,13 @@ Safety & Syntax Check:
130
112
131
113
```
132
114
133
-
Ollama Eval - erase all files
134
-
Using model: gpt-oss:20b
115
+
gpt-oss:20b generated the command:
135
116
136
-
Generated Command:
137
-
find . -type f -delete
117
+
rm -rf *
138
118
139
-
Safety & Syntax Check:
140
-
✅ Valid start: find
119
+
✅ Valid start: rm
141
120
✅ Valid Bash Syntax
142
-
⚠️ WARNING: The generated command contains a potentially dangerous token: "."
121
+
⚠️ WARNING: The generated command contains a potentially dangerous token: "rm"
143
122
144
123
Run command in sandbox (y/N/eval)? Aborted.
145
124
@@ -149,17 +128,10 @@ Run command in sandbox (y/N/eval)? Aborted.
Copy file name to clipboardExpand all lines: demos/ollama_generate.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# ollama_generate
2
2
3
-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.44.7
3
+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.44.8
4
4
5
5
## Setup
6
6
@@ -15,12 +15,10 @@ ollama_generate "gpt-oss:20b" "Describe a rabbit in 3 words"
15
15
```
16
16
```
17
17
# <thinking>
18
-
# The user wants: "Describe a rabbit in 3 words". So we need to give three adjectives or nouns? Might be descriptive words. Just three words. Let's pick "Playful", "Fluffy", "Spry". The user might prefer concise answer. We'll output them separated by commas or just space. I'll output: "Playful, fluffy, spry". Or "Playful fluffy spry".
19
-
20
-
Given the instruction: "Describe a rabbit in 3 words". So answer with exactly 3 words. Let's output something like "Playful, fluffy, swift" or "Playful fluffy swift". Let's choose "Playful", "Fluffy", "Swift". That fits. I'll output "Playful, Fluffy, Swift".
18
+
# The user requests: "Describe a rabbit in 3 words". So we need to describe a rabbit in 3 words. They likely want a concise description. The answer should be exactly 3 words: maybe "Fluffy, swift, playful" or "Soft, quick, curious". Need to exactly provide 3 words. They didn't ask for anything else. Provide 3 words separated by commas or just space? Usually comma separated is good. Must be just 3 words. Let's deliver.
21
19
# </thinking>
22
20
23
-
Playful, Fluffy, Swift
21
+
Fluffy, swift, playful.
24
22
```
25
23
26
24
## Demo Debug
@@ -30,8 +28,8 @@ OLLAMA_LIB_DEBUG=1 ollama_generate "gpt-oss:20b" "Describe a rabbit in 3 words"
30
28
```
31
29
```
32
30
# <thinking>
33
-
# The user: "Describe a rabbit in 3 words". They want a description using exactly three words? Likely they want a short description. Provide exactly 3 words that describe a rabbit. E.g., "soft, hopping, curious" that's three words: "Soft" "Hopping" "Curious". Count wise: each word separate. That is three words. Or "fluffy, swift, gentle". Need to include punctuation or not? Probably simple. They might want "fluffy", "gentle", "playful". That's three words as well. We can provide one set. They didn't specify any constraints beyond "in 3 words". So produce a short answer: "soft, hopping, curious". The output from assistant: "soft hopping curious"? They might want a description. Let's respond with three words. Let's go with "Soft, hopping, curious". That's 3 words. Or "fluffy, gentle, curious". I'll do "fluffy, gentle, curious". That should satisfy. I'll ensure no extra words. Provide just the three words separated by commas or spaces. Let's do "fluffy gentle curious". Provide exactly 3 words. I guess better to separate with commas: "fluffy, gentle, curious" That's still three words plus commas. Should be okay. Let's respond.
31
+
# We need to give a short answer: 3 words describing a rabbit. We could choose: "soft, agile, playful". Or "fluffy, quick, curious". The question: "Describe a rabbit in 3 words". So we just need 3 words. Could be any valid description. Let's choose something like "Soft, nimble, curious". Let's output exactly three words, no other text. Also no extra punctuation? The instruction is to "Describe a rabbit in 3 words". They didn't restrict punctuation. Maybe we should just list three words. I can do "Fluffy, speedy, friendly". That's 3 words. Let's do that.
0 commit comments