Skip to content

Commit 01df187

Browse files
committed
demos
1 parent 5518ecd commit 01df187

File tree

2 files changed

+63
-20
lines changed

2 files changed

+63
-20
lines changed

demos/test_thinking_stream.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
1-
--- Testing ollama_generate_stream with thinking ON ---
2-
[ERROR] ollama_generate_stream: No prompt supplied
3-
Usage: ollama_generate_stream -m <model> [-p <prompt>] [-h] [-v]
1+
# Test for streaming with thinking enabled
2+
3+
## Turn on thinking
4+
5+
```
6+
ollama_thinking on
7+
ollama_thinking
8+
```
9+
10+
thinking is on
11+
12+
## ollama_generate_stream
13+
14+
```
15+
ollama_generate_stream -m "$(ollama_model_random)" -p "Why is the sky blue? Be concise."
16+
```
417

5-
--- Testing ollama_chat_stream with thinking ON ---
6-
Error: Missing required arguments
718

8-
Usage: ollama_messages_add -r <role> -c <content> [-h] [-v]
9-
#### <thinking>
10-
#### [ERROR] _ollama_chat_payload: Message history is empty
11-
Error: Missing required arguments
1219

13-
Usage: ollama_messages_add -r <role> -c <content> [-h] [-v]
14-
[ERROR] ollama_messages_last_json: Message History is empty: count: [0]
15-
[ERROR] ollama_messages_last: error getting message content: 1
16-
[ERROR] ollama_chat: ollama_chat_json response empty
20+
The sky appears blue because of a phenomenon called Rayleigh scattering, where sunlight interacts with molecules and particles in Earth's atmosphere. Shorter wavelengths like blue light are scattered more than longer wavelengths, making the sky appear blue.
21+
22+
## ollama_chat_stream
23+
24+
```
25+
ollama_messages_clear
26+
ollama_messages_add -r "user" -c "Why is the ocean blue? Be concise."
27+
ollama_chat_stream -m "$(ollama_model_random)"
28+
```
29+
30+
#### <thinking>
31+
#### jq: parse error: Invalid numeric literal at line 1, column 4
32+
jq: parse error: Invalid numeric literal at line 1, column 4
1733

1834
#### </thinking>
1935

20-
[ERROR] ollama_chat_stream: ollama_chat failed with code 1
36+

demos/test_thinking_stream.sh

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
#!/usr/bin/env bash
22

3-
# Test for streaming with thinking enabled
3+
echo '# Test for streaming with thinking enabled'
44

55
# shellcheck source=../ollama_bash_lib.sh
66
source "$(dirname "$0")/../ollama_bash_lib.sh"
77

8-
echo '--- Testing ollama_generate_stream with thinking ON ---'
8+
echo
9+
echo '## Turn on thinking'
10+
# shellcheck disable=SC2016
11+
echo '
12+
```
13+
ollama_thinking on
14+
ollama_thinking
15+
```
16+
'
917
ollama_thinking on
10-
ollama_generate_stream "$(ollama_model_random)" "Why is the sky blue? Be concise."
18+
ollama_thinking
19+
20+
echo
21+
echo '## ollama_generate_stream'
22+
# shellcheck disable=SC2016
23+
echo '
24+
```
25+
ollama_generate_stream -m "$(ollama_model_random)" -p "Why is the sky blue? Be concise."
26+
```
27+
'
28+
ollama_generate_stream -m "$(ollama_model_random)" -p "Why is the sky blue? Be concise."
1129

1230
echo
13-
echo '--- Testing ollama_chat_stream with thinking ON ---'
31+
echo '## ollama_chat_stream'
32+
# shellcheck disable=SC2016
33+
echo '
34+
```
35+
ollama_messages_clear
36+
ollama_messages_add -r "user" -c "Why is the ocean blue? Be concise."
37+
ollama_chat_stream -m "$(ollama_model_random)"
38+
```
39+
'
1440
ollama_messages_clear
15-
ollama_messages_add "user" "Why is the ocean blue? Be concise."
16-
ollama_chat_stream "$(ollama_model_random)"
41+
ollama_messages_add -r "user" -c "Why is the ocean blue? Be concise."
42+
ollama_chat_stream -m "$(ollama_model_random)"
43+

0 commit comments

Comments
 (0)