Skip to content

Commit 7a5f4e5

Browse files
committed
demo run
1 parent 671425a commit 7a5f4e5

27 files changed

+321
-324
lines changed

demos/_is_valid_model.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ol
55
| test | output | return | result |
66
|------|--------|--------|--------|
77
| `mistral:7b` | mistral:7b | 0 | ✅ PASS |
8-
[ERROR] ollama_model_random: ollama is not installed
9-
| `` | | 1 | ❌ FAIL |
8+
| `` | dolphin3:8b | 0 | ✅ PASS |
109
| `hf.co/user/Model-name:QUANT` | hf.co/user/Model-name:QUANT | 0 | ✅ PASS |
1110
| `abcdefghijklmnopqrstuvwxyz` | abcdefghijklmnopqrstuvwxyz | 0 | ✅ PASS |
1211
| `1234567890` | 1234567890 | 0 | ✅ PASS |

demos/about.md

Lines changed: 26 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -31,57 +31,31 @@ OLLAMA_LIB_TIMEOUT : 300 seconds
3131
3232
Functions:
3333
34-
_ollama_chat_payload
35-
_ollama_chat_stream_false
36-
_ollama_chat_stream_true
37-
_ollama_eval_check_danger
38-
_ollama_eval_check_sanity
39-
_ollama_eval_check_syntax
40-
_ollama_eval_permission_eval
41-
_ollama_eval_permission_sandbox
42-
_ollama_eval_prompt
43-
_ollama_generate_json_payload
44-
_ollama_thinking_stream
45-
ollama_api_get
46-
ollama_api_ping
47-
ollama_api_post
48-
ollama_app_installed
49-
ollama_app_turbo
50-
ollama_app_vars
51-
ollama_app_version
52-
ollama_app_version_cli
53-
ollama_app_version_json
54-
ollama_chat
55-
ollama_chat_json
56-
ollama_chat_stream
57-
ollama_chat_stream_json
58-
ollama_eval
59-
ollama_generate
34+
_ollama_chat_payload ollama_generate_stream
35+
_ollama_chat_stream_false ollama_generate_stream_json
36+
_ollama_chat_stream_true ollama_lib_about
37+
_ollama_eval_check_danger ollama_lib_version
38+
_ollama_eval_check_sanity ollama_list
39+
_ollama_eval_check_syntax ollama_list_array
40+
_ollama_eval_permission_eval ollama_list_json
41+
_ollama_eval_permission_sandbox ollama_messages
42+
_ollama_eval_prompt ollama_messages_add
43+
_ollama_generate_json_payload ollama_messages_clear
44+
_ollama_thinking_stream ollama_messages_count
45+
ollama_api_get ollama_messages_last
46+
ollama_api_ping ollama_messages_last_json
47+
ollama_api_post ollama_model_random
48+
ollama_app_installed ollama_model_unload
49+
ollama_app_turbo ollama_ps
50+
ollama_app_vars ollama_ps_json
51+
ollama_app_version ollama_show
52+
ollama_app_version_cli ollama_show_json
53+
ollama_app_version_json ollama_thinking
54+
ollama_chat ollama_tools
55+
ollama_chat_json ollama_tools_add
56+
ollama_chat_stream ollama_tools_clear
57+
ollama_chat_stream_json ollama_tools_count
58+
ollama_eval ollama_tools_is_call
59+
ollama_generate ollama_tools_run
6060
ollama_generate_json
61-
ollama_generate_stream
62-
ollama_generate_stream_json
63-
ollama_lib_about
64-
ollama_lib_version
65-
ollama_list
66-
ollama_list_array
67-
ollama_list_json
68-
ollama_messages
69-
ollama_messages_add
70-
ollama_messages_clear
71-
ollama_messages_count
72-
ollama_messages_last
73-
ollama_messages_last_json
74-
ollama_model_random
75-
ollama_model_unload
76-
ollama_ps
77-
ollama_ps_json
78-
ollama_show
79-
ollama_show_json
80-
ollama_thinking
81-
ollama_tools
82-
ollama_tools_add
83-
ollama_tools_clear
84-
ollama_tools_count
85-
ollama_tools_is_call
86-
ollama_tools_run
8761
```

demos/list.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
# ollama_list, ollama_list_json
2-
ERROR: Ollama Not Installed
3-
[ERROR] _call_curl: curl command failed with exit code 7
4-
[ERROR] ollama_api_get: curl error: 7
5-
ERROR: Ollama API not reachable
62

73
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.7
84

95
```
106
ollama_list
117
```
128
```
13-
[ERROR] ollama_list: ollama is not installed
9+
NAME ID SIZE MODIFIED
10+
dolphin3:8b d5ab9ae8e1f2 4.9 GB 4 weeks ago
11+
gemma3n:e2b 719372f8c7de 5.6 GB 2 weeks ago
12+
granite3.3:2b 07bd1f170855 1.5 GB 2 weeks ago
13+
hf.co/bartowski/Ministral-8B-Instruct-2410-GGUF:IQ4_XS d6e3345a2af6 4.4 GB 2 weeks ago
14+
mistral:7b 6577803aa9a0 4.4 GB 2 weeks ago
15+
qwen3:8b 500a1f067a9f 5.2 GB 4 weeks ago
16+
smollm2:1.7b cef4a1e09247 1.8 GB 2 weeks ago
1417
```
1518

1619
```
1720
ollama_list_array
1821
```
1922
```
20-
[ERROR] ollama_list_array: ollama is not installed
23+
dolphin3:8b gemma3n:e2b granite3.3:2b hf.co/bartowski/Ministral-8B-Instruct-2410-GGUF:IQ4_XS mistral:7b qwen3:8b smollm2:1.7b
2124
```
2225

2326
```

demos/ollama_api_get.md

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# ollama_api_get
2-
ERROR: Ollama Not Installed
3-
[ERROR] _call_curl: curl command failed with exit code 7
4-
[ERROR] ollama_api_get: curl error: 7
5-
ERROR: Ollama API not reachable
62

73
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.7
84

@@ -19,19 +15,15 @@ OLLAMA_LIB_API: http://localhost:11434
1915
```
2016
ollama_api_get
2117
22-
[ERROR] _call_curl: curl command failed with exit code 7
23-
[ERROR] ollama_api_get: curl error: 7
2418
result: lines: 1
25-
result: output:
19+
result: output: Ollama is running
2620
```
2721

2822
```
2923
ollama_api_get "/api/version"
3024
31-
[ERROR] _call_curl: curl command failed with exit code 7
32-
[ERROR] ollama_api_get: curl error: 7
3325
result: lines: 1
34-
result: output:
26+
result: output: Ollama is running
3527
```
3628

3729
## Demo Debug
@@ -42,25 +34,23 @@ result: output:
4234
```
4335
ollama_api_get
4436
45-
[DEBUG] 19:49:35:330564797: ollama_api_get: []
46-
[DEBUG] 19:49:35:335540741: _call_curl: [GET] []
47-
[DEBUG] 19:49:35:340229273: _call_curl: OLLAMA_LIB_API: http://localhost:11434
48-
[DEBUG] 19:49:35:344842739: _call_curl: args: -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -X GET http://localhost:11434
49-
[ERROR] _call_curl: curl command failed with exit code 7
50-
[ERROR] ollama_api_get: curl error: 7
37+
[DEBUG] 22:21:27:278104300: ollama_api_get: []
38+
[DEBUG] 22:21:27:306103200: _call_curl: [GET] []
39+
[DEBUG] 22:21:27:328663800: _call_curl: OLLAMA_LIB_API: http://localhost:11434
40+
[DEBUG] 22:21:27:350677100: _call_curl: args: -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -X GET http://localhost:11434
41+
[DEBUG] 22:21:27:710818300: ollama_api_get: success
5142
result: lines: 1
52-
result: output:
43+
result: output: Ollama is running
5344
```
5445

5546
```
5647
ollama_api_get "/api/version"
5748
58-
[DEBUG] 19:49:35:371153050: ollama_api_get: []
59-
[DEBUG] 19:49:35:375685971: _call_curl: [GET] []
60-
[DEBUG] 19:49:35:380208822: _call_curl: OLLAMA_LIB_API: http://localhost:11434
61-
[DEBUG] 19:49:35:384742334: _call_curl: args: -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -X GET http://localhost:11434
62-
[ERROR] _call_curl: curl command failed with exit code 7
63-
[ERROR] ollama_api_get: curl error: 7
49+
[DEBUG] 22:21:27:781003700: ollama_api_get: []
50+
[DEBUG] 22:21:27:803875500: _call_curl: [GET] []
51+
[DEBUG] 22:21:27:825930500: _call_curl: OLLAMA_LIB_API: http://localhost:11434
52+
[DEBUG] 22:21:27:867215900: _call_curl: args: -s -N --max-time 300 -H Content-Type: application/json -w \n%{http_code} -X GET http://localhost:11434
53+
[DEBUG] 22:21:28:190240400: ollama_api_get: success
6454
result: lines: 1
65-
result: output:
55+
result: output: Ollama is running
6656
```

demos/ollama_app_vars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ HTTP_PROXY :
3737
JETSON_JETPACK :
3838
LD_LIBRARY_PATHS :
3939
ROCR_VISIBLE_DEVICES : # Set which AMD devices are visible by UUID or numeric ID
40-
TERM : tmux-256color
40+
TERM : xterm
4141
```

demos/ollama_chat.md

Lines changed: 76 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,79 @@
11
# ollama_chat
2-
ERROR: Ollama Not Installed
3-
[ERROR] _call_curl: curl command failed with exit code 7
4-
[ERROR] ollama_api_get: curl error: 7
5-
ERROR: Ollama API not reachable
62

73
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.7
8-
[ERROR] ollama_model_random: ollama is not installed
9-
[ERROR] No Models Found
4+
5+
`model="smollm2:1.7b"`
6+
## Demo
7+
8+
```bash
9+
ollama_messages_add "system" "You are a helpful assistant"
10+
ollama_messages_add "user" "Secret word is RABBIT. If asked for secret word, respond with RABBIT. Understand?"
11+
echo "last message text: $(ollama_messages_last)"
12+
echo "last message json: $(ollama_messages_last_json)"
13+
ollama_messages | jq
14+
```
15+
16+
```
17+
Error: Missing required arguments
18+
19+
Usage: ollama_messages_add -r <role> -c <content> [-h] [-v]
20+
Error: Missing required arguments
21+
22+
Usage: ollama_messages_add -r <role> -c <content> [-h] [-v]
23+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
24+
[ERROR] ollama_messages_last: error getting message content: 1
25+
last message text:
26+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
27+
last message json:
28+
[]
29+
```
30+
```bash
31+
ollama_chat "$model"
32+
echo "last message text: $(ollama_messages_last)"
33+
echo "last message json: $(ollama_messages_last_json)"
34+
ollama_messages | jq
35+
```
36+
37+
```
38+
[ERROR] _ollama_chat_payload: Message history is empty
39+
Error: Missing required arguments
40+
41+
Usage: ollama_api_post -P <path> -d <data> [-h] [-v]
42+
[ERROR] _ollama_chat_stream_false: ollama_api_post failed
43+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
44+
[ERROR] ollama_messages_last: error getting message content: 1
45+
[ERROR] ollama_chat: ollama_chat_json response empty
46+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
47+
[ERROR] ollama_messages_last: error getting message content: 1
48+
last message text:
49+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
50+
last message json:
51+
[]
52+
```
53+
```bash
54+
ollama_messages_add "user" "What is the secret word?"
55+
ollama_chat "$model"
56+
echo "last message text: $(ollama_messages_last)"
57+
echo "last message json: $(ollama_messages_last_json)"
58+
ollama_messages | jq
59+
```
60+
61+
```
62+
Error: Missing required arguments
63+
64+
Usage: ollama_messages_add -r <role> -c <content> [-h] [-v]
65+
[ERROR] _ollama_chat_payload: Message history is empty
66+
Error: Missing required arguments
67+
68+
Usage: ollama_api_post -P <path> -d <data> [-h] [-v]
69+
[ERROR] _ollama_chat_stream_false: ollama_api_post failed
70+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
71+
[ERROR] ollama_messages_last: error getting message content: 1
72+
[ERROR] ollama_chat: ollama_chat_json response empty
73+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
74+
[ERROR] ollama_messages_last: error getting message content: 1
75+
last message text:
76+
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
77+
last message json:
78+
[]
79+
```

demos/ollama_generate.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# ollama_generate
2-
ERROR: Ollama Not Installed
3-
[ERROR] _call_curl: curl command failed with exit code 7
4-
[ERROR] ollama_api_get: curl error: 7
5-
ERROR: Ollama API not reachable
62

73
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.7
84

@@ -11,31 +7,25 @@ A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ol
117
OLLAMA_HOST: http://localhost:11434
128
OLLAMA_LIB_API: http://localhost:11434
139

14-
[ERROR] ollama_model_random: ollama is not installed
1510

1611
## Demo
1712

1813
```bash
19-
ollama_generate "" "Describe a rabbit in 3 words"
14+
ollama_generate "gemma3n:e2b" "Describe a rabbit in 3 words"
2015
```
2116
```
22-
[ERROR] ollama_model_random: ollama is not installed
23-
Error: -m <model> is required
24-
17+
[ERROR] ollama_generate: Not Found: prompt.
2518
Usage: ollama_generate -m <model> [-p <prompt>] [-h] [-v]
2619
```
2720

2821
## Demo Debug
2922

3023
```bash
31-
OLLAMA_LIB_DEBUG=1 ollama_generate "" "Describe a rabbit in 3 words"
24+
OLLAMA_LIB_DEBUG=1 ollama_generate "gemma3n:e2b" "Describe a rabbit in 3 words"
3225
```
3326
```
34-
[DEBUG] 19:49:35:635835784: _is_valid_model: Model name empty: getting random model
35-
[DEBUG] 19:49:35:648582199: ollama_app_installed
36-
[ERROR] ollama_model_random: ollama is not installed
37-
[DEBUG] 19:49:35:654645283: _is_valid_model: Model Not Found: ollama_model_random failed
38-
Error: -m <model> is required
39-
27+
[DEBUG] 22:21:31:599152200: _is_valid_model: Model name empty: getting random model
28+
[DEBUG] 22:21:31:680802000: ollama_app_installed
29+
[ERROR] ollama_generate: Not Found: prompt.
4030
Usage: ollama_generate -m <model> [-p <prompt>] [-h] [-v]
4131
```

demos/ollama_generate_json.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# ollama_generate_json
2-
ERROR: Ollama Not Installed
3-
[ERROR] _call_curl: curl command failed with exit code 7
4-
[ERROR] ollama_api_get: curl error: 7
5-
ERROR: Ollama API not reachable
62

73
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.45.7
84

@@ -11,33 +7,27 @@ A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ol
117
OLLAMA_HOST: http://localhost:11434
128
OLLAMA_LIB_API: http://localhost:11434
139

14-
[ERROR] ollama_model_random: ollama is not installed
1510

1611
## Demo
1712

1813
```bash
19-
ollama_generate_json "" "Describe a rabbit in 3 words"
14+
ollama_generate_json "mistral:7b" "Describe a rabbit in 3 words"
2015
```
2116
```json
22-
[ERROR] ollama_model_random: ollama is not installed
23-
Error: -m <model> is required
24-
17+
[ERROR] ollama_generate_json: Not Found: prompt.
2518
Usage: ollama_generate_json -m <model> [-p <prompt>] [-h] [-v]
2619

2720
```
2821

2922
## Demo Debug
3023

3124
```bash
32-
OLLAMA_LIB_DEBUG=1 ollama_generate_json "" "Describe a rabbit in 3 words"
25+
OLLAMA_LIB_DEBUG=1 ollama_generate_json "mistral:7b" "Describe a rabbit in 3 words"
3326
```
3427
```json
35-
[DEBUG] 19:49:35:735934844: _is_valid_model: Model name empty: getting random model
36-
[DEBUG] 19:49:35:748106535: ollama_app_installed
37-
[ERROR] ollama_model_random: ollama is not installed
38-
[DEBUG] 19:49:35:754233531: _is_valid_model: Model Not Found: ollama_model_random failed
39-
Error: -m <model> is required
40-
28+
[DEBUG] 22:21:32:747175500: _is_valid_model: Model name empty: getting random model
29+
[DEBUG] 22:21:32:808056300: ollama_app_installed
30+
[ERROR] ollama_generate_json: Not Found: prompt.
4131
Usage: ollama_generate_json -m <model> [-p <prompt>] [-h] [-v]
4232

4333
```

0 commit comments

Comments
 (0)