Skip to content

Commit 79923b3

Browse files
authored
Merge pull request #126 from attogram/docs-link-aliases
feat: reorganize apps directory and add README
2 parents 01df187 + 8e7f7f0 commit 79923b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+655
-8492
lines changed

apps/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Apps
2+
3+
This directory contains interactive apps that use the Ollama Bash Lib.
4+
5+
| App | Description |
6+
|---|---|
7+
| [`chat.sh`](chat.sh) | An interactive chat session with message history. |
8+
| [`generate.sh`](generate.sh) | An interactive prompt for generating text, without message history. |
File renamed without changes.
File renamed without changes.

demos/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ This directory contains demos of the Ollama Bash Lib.
66
|------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
77
| [ollama_generate_json.md](ollama_generate_json.md) | Generate completion, json output with `ollama_generate_json` | [ollama_generate_json.sh](ollama_generate_json.sh) |
88
| [ollama_generate.md](ollama_generate.md) | Generate completion with `ollama_generate` | [ollama_generate.sh](ollama_generate.sh) |
9-
| [help.md](help.md) | Get help (-h) for all functions | [help.sh](help.sh) |
9+
| [function.help.md](function.help.md) | Get help (-h) for all functions | [function.help.sh](function.help.sh) |
10+
| [function.versions.md](function.versions.md) | Get version (-v) for all functions | [function.versions.sh](function.versions.sh) |
1011
| [review.lib.md](review.lib.md) | Code Review of `ollama_bash_lib.sh` | [review.lib.sh](review.lib.sh) |
1112
| [review.lib-security.md](review.lib-security.md) | Security Review of `ollama_bash_lib.sh` | [review.lib.sh](review.lib-security.sh) |
1213
| [review.readme.md](review.readme.md) | Marketing Review of `README.md` | [review.readme.sh](review.readme.sh) |
@@ -21,13 +22,11 @@ This directory contains demos of the Ollama Bash Lib.
2122
| [ps.md](ps.md) | Ollama running processes with `ollama_ps` and `ollama_ps_json` | [ps.sh](ps.sh) |
2223
| [show.md](show.md) | Model info with `ollama_show` and `ollama_show_json` | [show.sh](show.sh) |
2324
| [messages.md](messages.md) | Messages with `ollama_messages`, `ollama_messages_add`, `ollama_messages_count` and `ollama_messages_clear` | [messages.sh](messages.sh) |
24-
| [version.md](version.md) | Ollama version with `ollama_app_version`, `ollama_app_version_json` and `ollama_app_version_cli` | [version.sh](version.sh) |
25+
| [ollama_app_version.md](ollama_app_version.md) | Ollama version with `ollama_app_version`, `ollama_app_version_json` and `ollama_app_version_cli` | [ollama_app_version.sh](ollama_app_version.sh) |
2526
| [about.md](about.md) | Ollama Bash Lib info with `ollama_lib_about` and `ollama_lib_version` | [about.sh](about.sh) |
2627
| [ollama_api_get.md](ollama_api_get.md) | `ollama_api_get` tests | [ollama_api_get.sh](ollama_api_get.sh) |
2728
| [_is_valid_json.md](_is_valid_json.md) | Is a string valid json? with `_is_valid_json` | [_is_valid_json.sh](_is_valid_json.sh) |
2829
| [_is_valid_model.md](_is_valid_model.md) | Is a string a valid model name? with `_is_valid_model` | [_is_valid_model.sh](_is_valid_model.sh) |
2930
| [ollama_app_vars.md](ollama_app_vars.md) | Ollama environmental variables with `ollama_app_vars` | [ollama_app_vars.sh](ollama_app_vars.sh) |
30-
| [interactive.chat.sh](interactive.chat.sh) | Interactive Chat completion (with message history) | [interactive.chat.sh](interactive.chat.sh) |
31-
| [interactive.generate.sh](interactive.generate.sh) | Interactive Generate completion (no message history) | [interactive.generate.sh](interactive.generate.sh) |
3231

3332
To run all demos and save output to Markdown files: [run.demos.sh](run.demos.sh)

demos/_is_valid_model.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ 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-
| `` | gemma3n:e2b | 0 | ✅ PASS |
8+
[ERROR] ollama_model_random: ollama is not installed
9+
| `` | | 1 | ❌ FAIL |
910
| `hf.co/user/Model-name:QUANT` | hf.co/user/Model-name:QUANT | 0 | ✅ PASS |
1011
| `abcdefghijklmnopqrstuvwxyz` | abcdefghijklmnopqrstuvwxyz | 0 | ✅ PASS |
1112
| `1234567890` | 1234567890 | 0 | ✅ PASS |

demos/about.md

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,44 @@ OBL_TIMEOUT : 300 seconds
3131
3232
Functions:
3333
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_generate_json_payload ollama_lib_version
38-
_ollama_thinking_stream ollama_list
39-
ollama_api_get ollama_list_array
40-
ollama_api_ping ollama_list_json
41-
ollama_api_post ollama_messages
42-
ollama_app_installed ollama_messages_add
43-
ollama_app_turbo ollama_messages_clear
44-
ollama_app_vars ollama_messages_count
45-
ollama_app_version ollama_messages_last
46-
ollama_app_version_cli ollama_messages_last_json
47-
ollama_app_version_json ollama_model_random
48-
ollama_chat ollama_model_unload
49-
ollama_chat_json ollama_ps
50-
ollama_chat_stream ollama_ps_json
51-
ollama_chat_stream_json ollama_show
52-
ollama_generate ollama_show_json
53-
ollama_generate_json ollama_thinking
34+
_ollama_chat_payload
35+
_ollama_chat_stream_false
36+
_ollama_chat_stream_true
37+
_ollama_generate_json_payload
38+
_ollama_thinking_stream
39+
ollama_api_get
40+
ollama_api_ping
41+
ollama_api_post
42+
ollama_app_installed
43+
ollama_app_turbo
44+
ollama_app_vars
45+
ollama_app_version
46+
ollama_app_version_cli
47+
ollama_app_version_json
48+
ollama_chat
49+
ollama_chat_json
50+
ollama_chat_stream
51+
ollama_chat_stream_json
52+
ollama_generate
53+
ollama_generate_json
54+
ollama_generate_stream
55+
ollama_generate_stream_json
56+
ollama_lib_about
57+
ollama_lib_version
58+
ollama_list
59+
ollama_list_array
60+
ollama_list_json
61+
ollama_messages
62+
ollama_messages_add
63+
ollama_messages_clear
64+
ollama_messages_count
65+
ollama_messages_last
66+
ollama_messages_last_json
67+
ollama_model_random
68+
ollama_model_unload
69+
ollama_ps
70+
ollama_ps_json
71+
ollama_show
72+
ollama_show_json
73+
ollama_thinking
5474
```

demos/help.md renamed to demos/function.help.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -160,40 +160,28 @@ This function returns the current number of messages stored in the 'OBL_MESSAGES
160160
It can be used to check if a conversation has started or to monitor the length of the conversation history.
161161
```
162162

163-
./help.sh: line 62: ollama_tools_add: command not found
164-
## `ollama_tools_add -h`
163+
## `ollama_messages_last -h`
165164
```
165+
Usage: ollama_messages_last [-h] [-v]
166166
167-
```
168-
169-
./help.sh: line 62: ollama_tools: command not found
170-
## `ollama_tools -h`
171-
```
172-
173-
```
174-
175-
./help.sh: line 62: ollama_tools_count: command not found
176-
## `ollama_tools_count -h`
177-
```
167+
Get the content of the last message from the session history as a string.
178168
179-
```
180-
181-
./help.sh: line 62: ollama_tools_clear: command not found
182-
## `ollama_tools_clear -h`
183-
```
169+
-h Show this help and exit.
170+
-v Show version information and exit.
184171
172+
This function retrieves the last message using 'ollama_messages_last_json' and extracts the 'content' field, returning it as a plain string.
185173
```
186174

187-
./help.sh: line 62: ollama_tools_is_call: command not found
188-
## `ollama_tools_is_call -h`
175+
## `ollama_messages_last_json -h`
189176
```
177+
Usage: ollama_messages_last_json [-h] [-v]
190178
191-
```
179+
Get the last message from the session history in JSON format.
192180
193-
./help.sh: line 62: ollama_tools_run: command not found
194-
## `ollama_tools_run -h`
195-
```
181+
-h Show this help and exit.
182+
-v Show version information and exit.
196183
184+
This function retrieves the most recent message from the 'OBL_MESSAGES' array and outputs it as a JSON string.
197185
```
198186

199187
## `ollama_chat -h`
@@ -211,6 +199,21 @@ It handles the JSON parsing and returns only the content of the model\'s message
211199
It is ideal for simple, non-streaming chat interactions.
212200
```
213201

202+
## `ollama_chat_json -h`
203+
```
204+
Usage: ollama_chat_json -m <model> [-h] [-v]
205+
206+
Request a chat completion from a model, receiving JSON output.
207+
208+
-m <model> Name of the model to use (required).
209+
-h Show this help and exit.
210+
-v Show version information and exit.
211+
212+
This function sends the entire message history ('OBL_MESSAGES') to the specified model and returns the model's response as a raw JSON object.
213+
It serves as the foundation for 'ollama_chat_stream', which provides more user-friendly text-based outputs.
214+
If 'OBL_STREAM' is 0, it adds the assistant's response to the message history.
215+
```
216+
214217
## `ollama_chat_stream -h`
215218
```
216219
Usage: ollama_chat_stream -m <model> [-h] [-v]
@@ -485,4 +488,3 @@ Get the version of the Ollama Bash Lib.
485488
This function returns the current version number of the library as defined in the 'OBL_VERSION' variable.
486489
It is useful for checking the library version for compatibility or debugging purposes.
487490
```
488-

demos/help.sh renamed to demos/function.help.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@ functions=(
2727
ollama_messages_add
2828
ollama_messages_clear
2929
ollama_messages_count
30-
ollama_tools_add
31-
ollama_tools
32-
ollama_tools_count
33-
ollama_tools_clear
34-
ollama_tools_is_call
35-
ollama_tools_run
30+
ollama_messages_last
31+
ollama_messages_last_json
3632
ollama_chat
33+
ollama_chat_json
3734
ollama_chat_stream
3835
ollama_chat_stream_json
3936
ollama_list

demos/function.versions.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# function versions: -v
2+
3+
A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ollama-bash-lib) v0.46.3
4+
5+
## `ollama_api_get -v`
6+
```
7+
ollama_api_get version 0.46.3
8+
```
9+
10+
## `ollama_api_post -v`
11+
```
12+
ollama_api_post version 0.46.3
13+
```
14+
15+
## `ollama_api_ping -v`
16+
```
17+
ollama_api_ping version 0.46.3
18+
```
19+
20+
## `ollama_generate_json -v`
21+
```
22+
ollama_generate_json version 0.46.3
23+
```
24+
25+
## `ollama_generate -v`
26+
```
27+
ollama_generate version 0.46.3
28+
```
29+
30+
## `ollama_generate_stream_json -v`
31+
```
32+
ollama_generate_stream_json version 0.46.3
33+
```
34+
35+
## `ollama_generate_stream -v`
36+
```
37+
ollama_generate_stream version 0.46.3
38+
```
39+
40+
## `ollama_messages -v`
41+
```
42+
ollama_messages version 0.46.3
43+
```
44+
45+
## `ollama_messages_add -v`
46+
```
47+
ollama_messages_add version 0.46.3
48+
```
49+
50+
## `ollama_messages_clear -v`
51+
```
52+
ollama_messages_clear version 0.46.3
53+
```
54+
55+
## `ollama_messages_count -v`
56+
```
57+
ollama_messages_count version 0.46.3
58+
```
59+
60+
## `ollama_messages_last -v`
61+
```
62+
ollama_messages_last version 0.46.3
63+
```
64+
65+
## `ollama_messages_last_json -v`
66+
```
67+
ollama_messages_last_json version 0.46.3
68+
```
69+
70+
## `ollama_chat -v`
71+
```
72+
ollama_chat version 0.46.3
73+
```
74+
75+
## `ollama_chat_json -v`
76+
```
77+
ollama_chat_json version 0.46.3
78+
```
79+
80+
## `ollama_chat_stream -v`
81+
```
82+
ollama_chat_stream version 0.46.3
83+
```
84+
85+
## `ollama_chat_stream_json -v`
86+
```
87+
ollama_chat_stream_json version 0.46.3
88+
```
89+
90+
## `ollama_list -v`
91+
```
92+
ollama_list version 0.46.3
93+
```
94+
95+
## `ollama_list_json -v`
96+
```
97+
ollama_list_json version 0.46.3
98+
```
99+
100+
## `ollama_list_array -v`
101+
```
102+
ollama_list_array version 0.46.3
103+
```
104+
105+
## `ollama_model_random -v`
106+
```
107+
ollama_model_random version 0.46.3
108+
```
109+
110+
## `ollama_model_unload -v`
111+
```
112+
ollama_model_unload version 0.46.3
113+
```
114+
115+
## `ollama_ps -v`
116+
```
117+
ollama_ps version 0.46.3
118+
```
119+
120+
## `ollama_ps_json -v`
121+
```
122+
ollama_ps_json version 0.46.3
123+
```
124+
125+
## `ollama_show -v`
126+
```
127+
ollama_show version 0.46.3
128+
```
129+
130+
## `ollama_show_json -v`
131+
```
132+
ollama_show_json version 0.46.3
133+
```
134+
135+
## `ollama_app_installed -v`
136+
```
137+
ollama_app_installed version 0.46.3
138+
```
139+
140+
## `ollama_app_turbo -v`
141+
```
142+
ollama_app_turbo version 0.46.3
143+
```
144+
145+
## `ollama_app_vars -v`
146+
```
147+
ollama_app_vars version 0.46.3
148+
```
149+
150+
## `ollama_app_version -v`
151+
```
152+
ollama_app_version version 0.46.3
153+
```
154+
155+
## `ollama_app_version_json -v`
156+
```
157+
ollama_app_version_json version 0.46.3
158+
```
159+
160+
## `ollama_app_version_cli -v`
161+
```
162+
ollama_app_version_cli version 0.46.3
163+
```
164+
165+
## `ollama_thinking -v`
166+
```
167+
ollama_thinking version 0.46.3
168+
```
169+
170+
## `ollama_lib_about -v`
171+
```
172+
ollama_lib_about version 0.46.3
173+
```
174+
175+
## `ollama_lib_version -v`
176+
```
177+
ollama_lib_version version 0.46.3
178+
```

0 commit comments

Comments
 (0)