Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Apps

This directory contains interactive apps that use the Ollama Bash Lib.

| App | Description |
|---|---|
| [`chat.sh`](chat.sh) | An interactive chat session with message history. |
| [`generate.sh`](generate.sh) | An interactive prompt for generating text, without message history. |
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ This directory contains demos of the Ollama Bash Lib.
|------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [ollama_generate_json.md](ollama_generate_json.md) | Generate completion, json output with `ollama_generate_json` | [ollama_generate_json.sh](ollama_generate_json.sh) |
| [ollama_generate.md](ollama_generate.md) | Generate completion with `ollama_generate` | [ollama_generate.sh](ollama_generate.sh) |
| [help.md](help.md) | Get help (-h) for all functions | [help.sh](help.sh) |
| [function.help.md](function.help.md) | Get help (-h) for all functions | [function.help.sh](function.help.sh) |
| [function.versions.md](function.versions.md) | Get version (-v) for all functions | [function.versions.sh](function.versions.sh) |
| [review.lib.md](review.lib.md) | Code Review of `ollama_bash_lib.sh` | [review.lib.sh](review.lib.sh) |
| [review.lib-security.md](review.lib-security.md) | Security Review of `ollama_bash_lib.sh` | [review.lib.sh](review.lib-security.sh) |
| [review.readme.md](review.readme.md) | Marketing Review of `README.md` | [review.readme.sh](review.readme.sh) |
Expand All @@ -21,13 +22,11 @@ This directory contains demos of the Ollama Bash Lib.
| [ps.md](ps.md) | Ollama running processes with `ollama_ps` and `ollama_ps_json` | [ps.sh](ps.sh) |
| [show.md](show.md) | Model info with `ollama_show` and `ollama_show_json` | [show.sh](show.sh) |
| [messages.md](messages.md) | Messages with `ollama_messages`, `ollama_messages_add`, `ollama_messages_count` and `ollama_messages_clear` | [messages.sh](messages.sh) |
| [version.md](version.md) | Ollama version with `ollama_app_version`, `ollama_app_version_json` and `ollama_app_version_cli` | [version.sh](version.sh) |
| [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) |
| [about.md](about.md) | Ollama Bash Lib info with `ollama_lib_about` and `ollama_lib_version` | [about.sh](about.sh) |
| [ollama_api_get.md](ollama_api_get.md) | `ollama_api_get` tests | [ollama_api_get.sh](ollama_api_get.sh) |
| [_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) |
| [_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) |
| [ollama_app_vars.md](ollama_app_vars.md) | Ollama environmental variables with `ollama_app_vars` | [ollama_app_vars.sh](ollama_app_vars.sh) |
| [interactive.chat.sh](interactive.chat.sh) | Interactive Chat completion (with message history) | [interactive.chat.sh](interactive.chat.sh) |
| [interactive.generate.sh](interactive.generate.sh) | Interactive Generate completion (no message history) | [interactive.generate.sh](interactive.generate.sh) |

To run all demos and save output to Markdown files: [run.demos.sh](run.demos.sh)
3 changes: 2 additions & 1 deletion demos/_is_valid_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ A [demo](../README.md#demos) of [Ollama Bash Lib](https://github.com/attogram/ol
| test | output | return | result |
|------|--------|--------|--------|
| `mistral:7b` | mistral:7b | 0 | ✅ PASS |
| `` | gemma3n:e2b | 0 | ✅ PASS |
[ERROR] ollama_model_random: ollama is not installed
| `` | | 1 | ❌ FAIL |
| `hf.co/user/Model-name:QUANT` | hf.co/user/Model-name:QUANT | 0 | ✅ PASS |
| `abcdefghijklmnopqrstuvwxyz` | abcdefghijklmnopqrstuvwxyz | 0 | ✅ PASS |
| `1234567890` | 1234567890 | 0 | ✅ PASS |
Expand Down
60 changes: 40 additions & 20 deletions demos/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,44 @@ OBL_TIMEOUT : 300 seconds

Functions:

_ollama_chat_payload ollama_generate_stream
_ollama_chat_stream_false ollama_generate_stream_json
_ollama_chat_stream_true ollama_lib_about
_ollama_generate_json_payload ollama_lib_version
_ollama_thinking_stream ollama_list
ollama_api_get ollama_list_array
ollama_api_ping ollama_list_json
ollama_api_post ollama_messages
ollama_app_installed ollama_messages_add
ollama_app_turbo ollama_messages_clear
ollama_app_vars ollama_messages_count
ollama_app_version ollama_messages_last
ollama_app_version_cli ollama_messages_last_json
ollama_app_version_json ollama_model_random
ollama_chat ollama_model_unload
ollama_chat_json ollama_ps
ollama_chat_stream ollama_ps_json
ollama_chat_stream_json ollama_show
ollama_generate ollama_show_json
ollama_generate_json ollama_thinking
_ollama_chat_payload
_ollama_chat_stream_false
_ollama_chat_stream_true
_ollama_generate_json_payload
_ollama_thinking_stream
ollama_api_get
ollama_api_ping
ollama_api_post
ollama_app_installed
ollama_app_turbo
ollama_app_vars
ollama_app_version
ollama_app_version_cli
ollama_app_version_json
ollama_chat
ollama_chat_json
ollama_chat_stream
ollama_chat_stream_json
ollama_generate
ollama_generate_json
ollama_generate_stream
ollama_generate_stream_json
ollama_lib_about
ollama_lib_version
ollama_list
ollama_list_array
ollama_list_json
ollama_messages
ollama_messages_add
ollama_messages_clear
ollama_messages_count
ollama_messages_last
ollama_messages_last_json
ollama_model_random
ollama_model_unload
ollama_ps
ollama_ps_json
ollama_show
ollama_show_json
ollama_thinking
```
52 changes: 27 additions & 25 deletions demos/help.md → demos/function.help.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,40 +160,28 @@ This function returns the current number of messages stored in the 'OBL_MESSAGES
It can be used to check if a conversation has started or to monitor the length of the conversation history.
```

./help.sh: line 62: ollama_tools_add: command not found
## `ollama_tools_add -h`
## `ollama_messages_last -h`
```
Usage: ollama_messages_last [-h] [-v]

```

./help.sh: line 62: ollama_tools: command not found
## `ollama_tools -h`
```

```

./help.sh: line 62: ollama_tools_count: command not found
## `ollama_tools_count -h`
```
Get the content of the last message from the session history as a string.

```

./help.sh: line 62: ollama_tools_clear: command not found
## `ollama_tools_clear -h`
```
-h Show this help and exit.
-v Show version information and exit.

This function retrieves the last message using 'ollama_messages_last_json' and extracts the 'content' field, returning it as a plain string.
```

./help.sh: line 62: ollama_tools_is_call: command not found
## `ollama_tools_is_call -h`
## `ollama_messages_last_json -h`
```
Usage: ollama_messages_last_json [-h] [-v]

```
Get the last message from the session history in JSON format.

./help.sh: line 62: ollama_tools_run: command not found
## `ollama_tools_run -h`
```
-h Show this help and exit.
-v Show version information and exit.

This function retrieves the most recent message from the 'OBL_MESSAGES' array and outputs it as a JSON string.
```

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

## `ollama_chat_json -h`
```
Usage: ollama_chat_json -m <model> [-h] [-v]

Request a chat completion from a model, receiving JSON output.

-m <model> Name of the model to use (required).
-h Show this help and exit.
-v Show version information and exit.

This function sends the entire message history ('OBL_MESSAGES') to the specified model and returns the model's response as a raw JSON object.
It serves as the foundation for 'ollama_chat_stream', which provides more user-friendly text-based outputs.
If 'OBL_STREAM' is 0, it adds the assistant's response to the message history.
```

## `ollama_chat_stream -h`
```
Usage: ollama_chat_stream -m <model> [-h] [-v]
Expand Down Expand Up @@ -485,4 +488,3 @@ Get the version of the Ollama Bash Lib.
This function returns the current version number of the library as defined in the 'OBL_VERSION' variable.
It is useful for checking the library version for compatibility or debugging purposes.
```

9 changes: 3 additions & 6 deletions demos/help.sh → demos/function.help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ functions=(
ollama_messages_add
ollama_messages_clear
ollama_messages_count
ollama_tools_add
ollama_tools
ollama_tools_count
ollama_tools_clear
ollama_tools_is_call
ollama_tools_run
ollama_messages_last
ollama_messages_last_json
ollama_chat
ollama_chat_json
ollama_chat_stream
ollama_chat_stream_json
ollama_list
Expand Down
178 changes: 178 additions & 0 deletions demos/function.versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# function versions: -v

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

## `ollama_api_get -v`
```
ollama_api_get version 0.46.3
```

## `ollama_api_post -v`
```
ollama_api_post version 0.46.3
```

## `ollama_api_ping -v`
```
ollama_api_ping version 0.46.3
```

## `ollama_generate_json -v`
```
ollama_generate_json version 0.46.3
```

## `ollama_generate -v`
```
ollama_generate version 0.46.3
```

## `ollama_generate_stream_json -v`
```
ollama_generate_stream_json version 0.46.3
```

## `ollama_generate_stream -v`
```
ollama_generate_stream version 0.46.3
```

## `ollama_messages -v`
```
ollama_messages version 0.46.3
```

## `ollama_messages_add -v`
```
ollama_messages_add version 0.46.3
```

## `ollama_messages_clear -v`
```
ollama_messages_clear version 0.46.3
```

## `ollama_messages_count -v`
```
ollama_messages_count version 0.46.3
```

## `ollama_messages_last -v`
```
ollama_messages_last version 0.46.3
```

## `ollama_messages_last_json -v`
```
ollama_messages_last_json version 0.46.3
```

## `ollama_chat -v`
```
ollama_chat version 0.46.3
```

## `ollama_chat_json -v`
```
ollama_chat_json version 0.46.3
```

## `ollama_chat_stream -v`
```
ollama_chat_stream version 0.46.3
```

## `ollama_chat_stream_json -v`
```
ollama_chat_stream_json version 0.46.3
```

## `ollama_list -v`
```
ollama_list version 0.46.3
```

## `ollama_list_json -v`
```
ollama_list_json version 0.46.3
```

## `ollama_list_array -v`
```
ollama_list_array version 0.46.3
```

## `ollama_model_random -v`
```
ollama_model_random version 0.46.3
```

## `ollama_model_unload -v`
```
ollama_model_unload version 0.46.3
```

## `ollama_ps -v`
```
ollama_ps version 0.46.3
```

## `ollama_ps_json -v`
```
ollama_ps_json version 0.46.3
```

## `ollama_show -v`
```
ollama_show version 0.46.3
```

## `ollama_show_json -v`
```
ollama_show_json version 0.46.3
```

## `ollama_app_installed -v`
```
ollama_app_installed version 0.46.3
```

## `ollama_app_turbo -v`
```
ollama_app_turbo version 0.46.3
```

## `ollama_app_vars -v`
```
ollama_app_vars version 0.46.3
```

## `ollama_app_version -v`
```
ollama_app_version version 0.46.3
```

## `ollama_app_version_json -v`
```
ollama_app_version_json version 0.46.3
```

## `ollama_app_version_cli -v`
```
ollama_app_version_cli version 0.46.3
```

## `ollama_thinking -v`
```
ollama_thinking version 0.46.3
```

## `ollama_lib_about -v`
```
ollama_lib_about version 0.46.3
```

## `ollama_lib_version -v`
```
ollama_lib_version version 0.46.3
```
Loading