Skip to content

Commit 17eaa48

Browse files
committed
demos v0.45.3
1 parent 57c0c84 commit 17eaa48

31 files changed

+1313
-1803
lines changed

demos/_is_valid_json.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# _is_valid_json
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44

55
| test | result | return |
66
|------|--------|--------|

demos/_is_valid_model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# _is_valid_model
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44

55
| test | output | return | result |
66
|------|--------|--------|--------|

demos/about.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# ollama_lib_about, ollama_lib_version
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44

55
## Demo
66

77
```bash
88
ollama_lib_version
99
```
10-
0.45.2
10+
0.45.3
1111

1212
```bash
1313
ollama_lib_about
1414
```
1515
```
16-
Ollama Bash Lib v0.45.2
16+
Ollama Bash Lib v0.45.3
1717
A Bash Library to interact with Ollama
1818
1919
OLLAMA_LIB_NAME : Ollama Bash Lib
20-
OLLAMA_LIB_VERSION : 0.45.2
20+
OLLAMA_LIB_VERSION : 0.45.3
2121
OLLAMA_LIB_URL : https://github.com/attogram/ollama-bash-lib
2222
OLLAMA_LIB_DISCORD : https://discord.gg/BGQJCbYVBa
2323
OLLAMA_LIB_LICENSE : MIT

demos/help.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# help via -h and --help
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44
## Testing -h for all functions (first argument)
55

66
`ollama_api_get -h`

demos/list.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# ollama_list, ollama_list_json
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44

55
```
66
ollama_list
77
```
88
```
99
NAME ID SIZE MODIFIED
10-
gpt-oss:120b d98fe6ba01e6 65 GB 12 days ago
11-
gpt-oss:20b 05afbac4bad6 13 GB 12 days ago
10+
gpt-oss:120b d98fe6ba01e6 65 GB 13 days ago
11+
gpt-oss:20b 05afbac4bad6 13 GB 13 days ago
1212
```
1313

1414
```

demos/messages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ollama_messages, ollama_messages_add, ollama_messages_count
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44
```
55
66
ollama_messages_count: 0

demos/ollama_api_get.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ollama_api_get
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44

55
## Setup
66

@@ -42,6 +42,12 @@ result: output: {"version":"0.0.0"}
4242
```
4343
ollama_api_get
4444
45+
[DEBUG] 22:55:45:164316000: ollama_api_get: []
46+
[DEBUG] 22:55:45:195509400: _call_curl: [GET] []
47+
[DEBUG] 22:55:45:229228200: _call_curl: OLLAMA_LIB_API: https://ollama.com
48+
[DEBUG] 22:55:45:251170600: _call_curl: Turbo Mode
49+
[DEBUG] 22:55:45:275213100: _call_curl: args: -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -H Authorization: Bearer [REDACTED] -X GET https://ollama.com
50+
[DEBUG] 22:55:45:605732800: ollama_api_get: success
4551
result: lines: 394
4652
result: output:
4753
@@ -57,6 +63,12 @@ result: output:
5763
```
5864
ollama_api_get "/api/version"
5965
66+
[DEBUG] 22:55:45:683892600: ollama_api_get: [/api/version]
67+
[DEBUG] 22:55:45:707385600: _call_curl: [GET] [/api/version]
68+
[DEBUG] 22:55:45:730168600: _call_curl: OLLAMA_LIB_API: https://ollama.com
69+
[DEBUG] 22:55:45:754885200: _call_curl: Turbo Mode
70+
[DEBUG] 22:55:45:785791400: _call_curl: args: -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -H Authorization: Bearer [REDACTED] -X GET https://ollama.com/api/version
71+
[DEBUG] 22:55:46:090944500: ollama_api_get: success
6072
result: lines: 1
6173
result: output: {"version":"0.0.0"}
6274
```

demos/ollama_app_vars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ollama_app_vars
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44

55
```
66
OLLAMA_AUTH : # Enables authentication between the Ollama client and server

demos/ollama_chat.md

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# ollama_chat
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44

55
## Demo
66

77
```bash
88
ollama_messages_add "system" "You are a helpful assistant"
99
ollama_messages_add "user" "The secret word is RABBIT. If asked for the secret word, respond with RABBIT. Understand?"
10-
response="$(ollama_chat "gpt-oss:120b")"
10+
response="$(ollama_chat "gpt-oss:20b")"
1111
printf '%s\n' "$response"
1212
ollama_messages_add 'assistant' "$response"
1313
```
14-
Understood. If you ask for the secret word, I’ll respond with “RABBIT.”
14+
Got it! When you ask for the secret word, I’ll reply with “RABBIT.”
1515

1616
```bash
1717
ollama_messages_add "user" "What is the secret word??"
18-
response="$(ollama_chat "gpt-oss:120b")"
18+
response="$(ollama_chat "gpt-oss:20b")"
1919
printf '%s\n' "$response"
2020
ollama_messages_add 'assistant' "$response"
2121
```
@@ -36,7 +36,7 @@ ollama_messages | jq
3636
},
3737
{
3838
"role": "assistant",
39-
"content": "Understood. If you ask for the secret word, I’ll respond with “RABBIT.”"
39+
"content": "Got it! When you ask for the secret word, I’ll reply with “RABBIT.”"
4040
},
4141
{
4242
"role": "user",
@@ -55,28 +55,74 @@ ollama_messages | jq
5555
OLLAMA_LIB_DEBUG=1
5656
ollama_messages_add "system" "You are a helpful assistant"
5757
ollama_messages_add "user" "The secret word is RABBIT. If asked for the secret word, respond with RABBIT. Understand?"
58-
response="$(ollama_chat "gpt-oss:120b")"
58+
response="$(ollama_chat "gpt-oss:20b")"
5959
printf '%s\n' "$response"
6060
ollama_messages_add 'assistant' "$response"
6161
```
6262
```
63-
Understood.
63+
[DEBUG] 22:55:49:829630200: ollama_messages_add: [system] [You are a helpful assistant]
64+
[DEBUG] 22:55:49:870509500: ollama_messages_add: [user] [The secret word is RABBIT. If I ask you fo]
65+
[DEBUG] 22:55:49:909555100: ollama_chat: [gpt-oss:20b]
66+
[DEBUG] 22:55:49:939685500: _is_valid_model: VALID: [gpt-oss:20b]
67+
[DEBUG] 22:55:49:968578800: ollama_chat: model: [gpt-oss:20b]
68+
[DEBUG] 22:55:50:004260600: ollama_chat_json: [gpt-oss:20b]
69+
[DEBUG] 22:55:50:036332600: _is_valid_model: VALID: [gpt-oss:20b]
70+
[DEBUG] 22:55:50:059130700: ollama_chat_json: model: [gpt-oss:20b]
71+
[DEBUG] 22:55:50:103701600: ollama_chat_json: json_payload: [{"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T]
72+
[DEBUG] 22:55:50:144525900: ollama_api_post: [/api/chat] {"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T
73+
[DEBUG] 22:55:50:167682000: _call_curl: [POST] [/api/chat] {"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T
74+
[DEBUG] 22:55:50:207030400: _is_valid_json: success
75+
[DEBUG] 22:55:50:228680000: _call_curl: OLLAMA_LIB_API: https://ollama.com
76+
[DEBUG] 22:55:50:251350600: _call_curl: Turbo Mode
77+
[DEBUG] 22:55:50:279893700: _call_curl: json_body: {"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T
78+
[DEBUG] 22:55:50:301935500: _call_curl: piping json_body | curl -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -H Authorization: Bearer [REDACTED] -X POST https://ollama.com/api/chat -d @-
79+
[DEBUG] 22:55:51:617537000: ollama_api_post: success
80+
[DEBUG] 22:55:51:664663000: _is_valid_json: success
81+
[DEBUG] 22:55:51:710601100: ollama_chat_json: content: [Got it! The secret word is RABBIT. When yo]
82+
[DEBUG] 22:55:51:731765200: ollama_chat_json: success
83+
[DEBUG] 22:55:51:788521400: _is_valid_json: success
84+
[DEBUG] 22:55:51:845320700: ollama_chat: return: 0
85+
Got it! The secret word is RABBIT. When you ask for it, I’ll respond with "RABBIT".
86+
[DEBUG] 22:55:51:871884200: ollama_messages_add: [assistant] [Got it! The secret word is RABBIT. When yo]
6487
```
6588

6689
```bash
6790
ollama_messages_add "user" "What is the secret word??"
68-
response="$(ollama_chat "gpt-oss:120b")"
91+
response="$(ollama_chat "gpt-oss:20b")"
6992
printf '%s\n' "$response"
7093
ollama_messages_add 'assistant' "$response"
7194
```
7295
```
96+
[DEBUG] 22:55:51:906845700: ollama_messages_add: [user] [What is the secret word??]
97+
[DEBUG] 22:55:51:954720900: ollama_chat: [gpt-oss:20b]
98+
[DEBUG] 22:55:51:983049400: _is_valid_model: VALID: [gpt-oss:20b]
99+
[DEBUG] 22:55:52:028155500: ollama_chat: model: [gpt-oss:20b]
100+
[DEBUG] 22:55:52:057328600: ollama_chat_json: [gpt-oss:20b]
101+
[DEBUG] 22:55:52:087671900: _is_valid_model: VALID: [gpt-oss:20b]
102+
[DEBUG] 22:55:52:110740600: ollama_chat_json: model: [gpt-oss:20b]
103+
[DEBUG] 22:55:52:149236000: ollama_chat_json: json_payload: [{"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T]
104+
[DEBUG] 22:55:52:187516600: ollama_api_post: [/api/chat] {"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T
105+
[DEBUG] 22:55:52:210540700: _call_curl: [POST] [/api/chat] {"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T
106+
[DEBUG] 22:55:52:253628600: _is_valid_json: success
107+
[DEBUG] 22:55:52:275970700: _call_curl: OLLAMA_LIB_API: https://ollama.com
108+
[DEBUG] 22:55:52:298928300: _call_curl: Turbo Mode
109+
[DEBUG] 22:55:52:325318600: _call_curl: json_body: {"model":"gpt-oss:20b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"T
110+
[DEBUG] 22:55:52:358093200: _call_curl: piping json_body | curl -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -H Authorization: Bearer [REDACTED] -X POST https://ollama.com/api/chat -d @-
111+
[DEBUG] 22:55:53:773050400: ollama_api_post: success
112+
[DEBUG] 22:55:53:818321500: _is_valid_json: success
113+
[DEBUG] 22:55:53:883263600: ollama_chat_json: content: [RABBIT]
114+
[DEBUG] 22:55:53:906670900: ollama_chat_json: success
115+
[DEBUG] 22:55:53:973483600: _is_valid_json: success
116+
[DEBUG] 22:55:54:050848900: ollama_chat: return: 0
73117
RABBIT
118+
[DEBUG] 22:55:54:081507500: ollama_messages_add: [assistant] [RABBIT]
74119
```
75120

76121
```bash
77122
ollama_messages | jq
78123
```
79124
```json
125+
[DEBUG] 22:55:54:126324300: ollama_messages
80126
[
81127
{
82128
"role": "system",
@@ -88,7 +134,7 @@ ollama_messages | jq
88134
},
89135
{
90136
"role": "assistant",
91-
"content": "Understood."
137+
"content": "Got it! The secret word is RABBIT. When you ask for it, I’ll respond with \"RABBIT\"."
92138
},
93139
{
94140
"role": "user",

demos/ollama_eval.md

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ollama_eval, oe
22

3-
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.2
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.3
44
## Usage
55
```bash
66
ollama_eval "task" # generate command with random model
@@ -15,14 +15,13 @@ oe "task" "model" # alias for ollama_eval
1515
1616
gpt-oss:20b generated the command:
1717
18-
while true; do clear; for i in $(seq 1 25); do printf "\e[$((RANDOM%25+1));$((RANDOM%80+1))H$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c1)"; done; sleep .1; done
18+
while true; do tput civis; clear; for i in $(seq $(tput lines)); do for j in $(seq $(tput cols)); do printf "\e[48;5;%dm " $((RANDOM%256)); done; printf "\n"; done; sleep .05; tput cnorm; done
1919
2020
✅ Valid start: while
2121
✅ Valid Bash Syntax
2222
✅ No dangerous commands found
2323
24-
Run command in sandbox (y/N/eval)? Aborted.
25-
24+
Run command in sandbox (y/N/eval)?
2625
```
2726

2827
`oe "show me all shell files in current directory"`
@@ -31,14 +30,13 @@ Run command in sandbox (y/N/eval)? Aborted.
3130
3231
gpt-oss:120b generated the command:
3332
34-
find . -maxdepth 1 -type f -name "*.sh" -print
33+
ls -1 *.sh 2>/dev/null
3534
36-
✅ Valid start: find
35+
✅ Valid start: ls
3736
✅ Valid Bash Syntax
38-
⚠️ WARNING: The generated command contains a potentially dangerous token: "."
39-
40-
Run command in sandbox (y/N/eval)? Aborted.
37+
✅ No dangerous commands found
4138
39+
Run command in sandbox (y/N/eval)?
4240
```
4341

4442
`oe "find files larger than 1GB"`
@@ -47,29 +45,27 @@ Run command in sandbox (y/N/eval)? Aborted.
4745
4846
gpt-oss:120b generated the command:
4947
50-
find . -type f -size +1G
48+
find / -type f -size +1G -print 2>/dev/null
5149
5250
✅ Valid start: find
5351
✅ Valid Bash Syntax
54-
⚠️ WARNING: The generated command contains a potentially dangerous token: "."
55-
56-
Run command in sandbox (y/N/eval)? Aborted.
52+
✅ No dangerous commands found
5753
54+
Run command in sandbox (y/N/eval)?
5855
```
5956

6057
`oe "what version of bash am I using?"`
6158

6259
```
6360
64-
gpt-oss:20b generated the command:
61+
gpt-oss:120b generated the command:
6562
66-
echo "$BASH_VERSION"
63+
bash --version | head -n1
6764
68-
✅ Valid start: echo
65+
✅ Valid start: bash
6966
✅ Valid Bash Syntax
70-
✅ No dangerous commands found
71-
72-
Run command in sandbox (y/N/eval)? Aborted.
67+
⚠️ WARNING: The generated command contains a potentially dangerous token: "bash"
68+
[ERROR] ollama_eval: cmd failed danger check
7369
7470
```
7571

@@ -79,14 +75,13 @@ Run command in sandbox (y/N/eval)? Aborted.
7975
8076
gpt-oss:120b generated the command:
8177
82-
case "$(uname -s)" in CYGWIN*|MINGW*|MSYS*) echo windows;; Darwin*) echo mac;; Linux*) echo linux;; *) echo unknown;; esac
78+
case "$(uname -s)" in CYGWIN*|MINGW*) echo "Windows";; Darwin) echo "Mac";; Linux) echo "Linux";; *) echo "Other";; esac
8379
8480
✅ Valid start: case
8581
✅ Valid Bash Syntax
8682
✅ No dangerous commands found
8783
88-
Run command in sandbox (y/N/eval)? Aborted.
89-
84+
Run command in sandbox (y/N/eval)?
9085
```
9186

9287
`oe "get system load"`
@@ -101,41 +96,43 @@ cat /proc/loadavg
10196
✅ Valid Bash Syntax
10297
✅ No dangerous commands found
10398
104-
Run command in sandbox (y/N/eval)? Aborted.
105-
99+
Run command in sandbox (y/N/eval)?
106100
```
107101

108102
`oe ""`
109103

110104
```
111105
[ERROR] ollama_eval: Task Not Found. Usage: oe "task" "model"
106+
[ERROR] ollama_eval: _ollama_eval_prompt failed
112107
113108
```
114109

115110
`oe "erase all files"`
116111

117112
```
118113
119-
gpt-oss:120b generated the command:
114+
gpt-oss:20b generated the command:
120115
121-
I’m sorry, but I can’t help with that.
116+
find . -mindepth 1 -delete
122117
123-
❌ Invalid start: I’m
118+
✅ Valid start: find
119+
✅ Valid Bash Syntax
120+
⚠️ WARNING: The generated command contains a potentially dangerous token: "."
121+
[ERROR] ollama_eval: cmd failed danger check
124122
125123
```
126124

127125
`oe "destroy this computer!"`
128126

129127
```
130128
131-
gpt-oss:120b generated the command:
129+
gpt-oss:20b generated the command:
132130
133131
echo "I’m sorry, but I can’t help with that."
134132
135133
✅ Valid start: echo
136134
✅ Valid Bash Syntax
137135
✅ No dangerous commands found
138136
139-
Run command in sandbox (y/N/eval)? Aborted.
140-
137+
Run command in sandbox (y/N/eval)?
141138
```

0 commit comments

Comments
 (0)