Skip to content

Commit 6a5b1de

Browse files
authored
Update stop sequences in parameters (#861)
* Stop sequence parameter update to align with ollama Signed-off-by: Jing Chen <[email protected]> * Update results Signed-off-by: Jing Chen <[email protected]> --------- Signed-off-by: Jing Chen <[email protected]>
1 parent e9b02f6 commit 6a5b1de

File tree

13 files changed

+51
-54
lines changed

13 files changed

+51
-54
lines changed

examples/callback/repair_prompt.pdl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ lastOf:
1111
- def: raw_output
1212
model: ollama_chat/granite3.2:2b
1313
parameters:
14-
#stop_sequences: "\n\n"
1514
temperature: 0
1615

1716
- lang: python

examples/cldk/cldk-assistant.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ text:
130130

131131

132132
parameters:
133-
stop_sequences: "Question"
133+
stop: ["Question"]
134134
temperature: 0
135135
- "\n\n***Executing the above PDL code:\n\n"
136136
- lang: python

examples/demo/10-sdg.pdl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ defs:
6868
input: ${teacher_input}
6969
parameters:
7070
temperature: 0
71-
stop_sequences: "${teacher_stop_token}"
71+
stop: ["${teacher_stop_token}"]
7272
max_new_tokens: ${prompt_data.max_new_tokens}
7373
parser:
7474
regex: '### Question [0-9]+:\s*([^#\n]+)'
@@ -156,7 +156,7 @@ defs:
156156
model: ${teacher_model}
157157
input: ${teacher_input}
158158
parameters:
159-
stop_sequences: "${teacher_stop_token}"
159+
stop: ["${teacher_stop_token}"]
160160
max_new_tokens: ${prompt_data.max_new_tokens}
161161
temperature: 0
162162
parser:
@@ -252,7 +252,7 @@ defs:
252252
model: ${teacher_model}
253253
input: ${teacher_input}
254254
parameters:
255-
stop_sequences: ${ ([teacher_stop_token] + prompt_data.additional_stop_tokens) | join(',') }
255+
stop: ["${ ([teacher_stop_token] + prompt_data.additional_stop_tokens) | join(',') }"]
256256
max_new_tokens: ${prompt_data.max_new_tokens}
257257
temperature: 0
258258
parsed_answer:
@@ -339,7 +339,7 @@ defs:
339339
model: ${teacher_model}
340340
input: ${teacher_input}
341341
parameters:
342-
stop_sequences: "${teacher_stop_token}"
342+
stop: ["${teacher_stop_token}"]
343343
max_new_tokens: ${prompt_data.max_new_tokens}
344344
temperature: 0
345345
parser:

examples/notebooks/demo.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
},
348348
{
349349
"cell_type": "code",
350-
"execution_count": 3,
350+
"execution_count": null,
351351
"id": "dfef7096-b7a6-4966-8356-a306e701974b",
352352
"metadata": {
353353
"scrolled": true
@@ -395,12 +395,12 @@
395395
" - def: thought\n",
396396
" model: replicate/ibm-granite/granite-3.1-8b-instruct\n",
397397
" parameters:\n",
398-
" stop_sequences: \"Act:\"\n",
398+
" stop: [\"Act:\"]\n",
399399
" temperature: 0\n",
400400
" - def: rawAction\n",
401401
" model: replicate/ibm-granite/granite-3.1-8b-instruct\n",
402402
" parameters:\n",
403-
" stop_sequences: \"\\n\"\n",
403+
" stop: [\"\\n\"]\n",
404404
" temperature: 0\n",
405405
" - def: action\n",
406406
" lang: python\n",

examples/notebooks/notebook.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 4,
15+
"execution_count": null,
1616
"id": "f3c62df1-0347-4711-acd7-3892cfd5df30",
1717
"metadata": {},
1818
"outputs": [
@@ -32,7 +32,7 @@
3232
"- \"Hello\\n\"\n",
3333
"- model: \"replicate/ibm-granite/granite-3.1-8b-instruct\"\n",
3434
" parameters:\n",
35-
" stop_sequences: \"!\"\n",
35+
" stop: [\"!\"]\n",
3636
" "
3737
]
3838
},

examples/notebooks/notebook_debug.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 2,
15+
"execution_count": null,
1616
"id": "f3c62df1-0347-4711-acd7-3892cfd5df30",
1717
"metadata": {},
1818
"outputs": [
@@ -166,7 +166,7 @@
166166
"- Hello,\n",
167167
"- model: \"replicate/ibm-granite/granite-3.1-8b-instruct\"\n",
168168
" parameters:\n",
169-
" stop_sequences: \"!\""
169+
" stop: [\"!\"]"
170170
]
171171
},
172172
{

examples/notebooks/pdl.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
{
4848
"cell_type": "code",
49-
"execution_count": 2,
49+
"execution_count": null,
5050
"id": "f3c62df1-0347-4711-acd7-3892cfd5df30",
5151
"metadata": {},
5252
"outputs": [
@@ -75,7 +75,7 @@
7575
"- \"What is the meaning of life?\\n\"\n",
7676
"- model: replicate/ibm-granite/granite-3.2-8b-instruct\n",
7777
" parameters:\n",
78-
" stop_sequences: \"!\"\n",
78+
" stop: [\"!\"]\n",
7979
" include_stop_sequence: true"
8080
]
8181
},
@@ -153,7 +153,7 @@
153153
]
154154
},
155155
{
156-
"name": "stdin",
156+
"name": "stdout",
157157
"output_type": "stream",
158158
"text": [
159159
">>> What is APR?\n"
@@ -169,7 +169,7 @@
169169
]
170170
},
171171
{
172-
"name": "stdin",
172+
"name": "stdout",
173173
"output_type": "stream",
174174
"text": [
175175
">>> say it like a poem\n"
@@ -200,7 +200,7 @@
200200
]
201201
},
202202
{
203-
"name": "stdin",
203+
"name": "stdout",
204204
"output_type": "stream",
205205
"text": [
206206
">>> quit\n"

examples/sdk/hello_dict.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
"text": [
55
"Hello\n",
66
{
7-
"model": "ollama_chat/granite3.2:8b",
8-
"parameters": {"stop_sequences": "!"},
7+
"model": "ollama_chat/granite3.2:2b",
8+
"parameters": {
9+
"stop": ["!"],
10+
},
911
},
1012
]
1113
}

examples/sdk/hello_prog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
text=[
77
"Hello\n",
88
LitellmModelBlock(
9-
model="ollama_chat/granite3.2:8b",
10-
parameters=LitellmParameters(stop_sequences="!"), # pyright: ignore
9+
model="ollama_chat/granite3.2:2b",
10+
parameters=LitellmParameters(stop=["!"]), # pyright: ignore
1111
),
1212
]
1313
)

examples/sdk/hello_str.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
HELLO = """
44
text:
55
- "Hello\n"
6-
- model: ollama_chat/granite3.2:8b
6+
- model: ollama_chat/granite3.2:2b
77
parameters:
8-
stop_sequences: '!'
8+
stop: ['!']
99
"""
1010

1111

0 commit comments

Comments
 (0)