Skip to content

Commit bea3850

Browse files
authored
feat: rename max_iterations into maxIterations (#961)
BREAKING CHANGE -- Signed-off-by: Louis Mandel <[email protected]>
1 parent 9aa0df2 commit bea3850

21 files changed

+73
-69
lines changed

docs/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ can also contain either a string, or a block, or a list (and similarly for `else
695695
The chatbot keeps looping by making a call to a model, asking the user if the generated text is a good answer,
696696
and asking `why not?` if the answer (stored in variable `eval`) is `no`. The loop ends when `eval` becomes `yes`. This is specified with a Jinja expression on line 18.
697697

698-
Notice that the `repeat` and `then` blocks are followed by `text`. This is because of the semantics of lists in PDL. If we want to aggregate the result by stringifying every element in the list and collating them together, then we need the keyword `text` to precede a list. The number of iterations of a loop can be bounded by adding a `max_iterations` field.
698+
Notice that the `repeat` and `then` blocks are followed by `text`. This is because of the semantics of lists in PDL. If we want to aggregate the result by stringifying every element in the list and collating them together, then we need the keyword `text` to precede a list. The number of iterations of a loop can be bounded by adding a `maxIterations` field.
699699

700700
The way that the result of each iteration is collated with other iterations can be customized in PDL using
701701
the `join` feature (see the following section).
@@ -804,14 +804,14 @@ The following example shows a while loop in PDL:
804804

805805
The `while` field indicates the looping condition and `repeat` contains the body of the loop.
806806

807-
This loop can be rewritten using `max_iterations` to bound the number of iterations and `index` to name the iteration number.
807+
This loop can be rewritten using `maxIterations` to bound the number of iterations and `index` to name the iteration number.
808808

809809
```yaml
810810
--8<-- "./examples/tutorial/loop_index.pdl"
811811
```
812812

813813

814-
Notice that `for`, `while`, `until`, and `max_iterations` can all be combined in the same `repeat` block. The loop exits as soon as one of the exit conditions is satisfied:
814+
Notice that `for`, `while`, `until`, and `maxIterations` can all be combined in the same `repeat` block. The loop exits as soon as one of the exit conditions is satisfied:
815815

816816
```yaml
817817
--8<-- "./examples/tutorial/repeat.pdl"

examples/gsm8k/gsm8k-plan-few-shots.pdl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ text:
8989
pdl_context: []
9090
problem: ${ problem.question }
9191
demos: ${ demos }
92-
max_iterations: ${ MAX_ITERATIONS }
92+
maxIterations: ${ MAX_ITERATIONS }
9393
def: plans
9494
join:
9595
as: array
@@ -101,7 +101,7 @@ text:
101101
args:
102102
pdl_context: []
103103
plan: ${ plan }
104-
max_iterations: ${ MAX_ITERATIONS }
104+
maxIterations: ${ MAX_ITERATIONS }
105105
def: solutions
106106
join:
107107
as: array
@@ -113,7 +113,7 @@ text:
113113
args:
114114
pdl_context: []
115115
solution: ${ solution }
116-
max_iterations: ${ MAX_ITERATIONS }
116+
maxIterations: ${ MAX_ITERATIONS }
117117
def: results
118118
join:
119119
as: array
@@ -127,7 +127,7 @@ text:
127127
pdl_context: []
128128
result: ${ result }
129129
truth: ${ problem.answer }
130-
max_iterations: ${ MAX_ITERATIONS }
130+
maxIterations: ${ MAX_ITERATIONS }
131131
def: stats
132132
join:
133133
as: array

examples/gsm8k/gsm8k-plan.pdl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ text:
7474
args:
7575
pdl_context: []
7676
problem: ${ problem.question }
77-
max_iterations: ${ MAX_ITERATIONS }
77+
maxIterations: ${ MAX_ITERATIONS }
7878
def: plans
7979
join:
8080
as: array
@@ -86,7 +86,7 @@ text:
8686
args:
8787
pdl_context: []
8888
plan: ${ plan }
89-
max_iterations: ${ MAX_ITERATIONS }
89+
maxIterations: ${ MAX_ITERATIONS }
9090
def: solutions
9191
join:
9292
as: array
@@ -98,7 +98,7 @@ text:
9898
args:
9999
pdl_context: []
100100
solution: ${ solution }
101-
max_iterations: ${ MAX_ITERATIONS }
101+
maxIterations: ${ MAX_ITERATIONS }
102102
def: results
103103
join:
104104
as: array
@@ -112,7 +112,7 @@ text:
112112
pdl_context: []
113113
result: ${ result }
114114
truth: ${ problem.answer }
115-
max_iterations: ${ MAX_ITERATIONS }
115+
maxIterations: ${ MAX_ITERATIONS }
116116
def: stats
117117
join:
118118
as: array

examples/gsm8k/gsm8k-tot-few-shot.pdl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ text:
122122
pdl_context: []
123123
problem: ${ problem.question }
124124
demos: ${ demos }
125-
max_iterations: ${ N }
125+
maxIterations: ${ N }
126126
join:
127127
as: array
128-
max_iterations: ${ MAX_ITERATIONS }
128+
maxIterations: ${ MAX_ITERATIONS }
129129
def: plans
130130
join:
131131
as: array
@@ -141,12 +141,12 @@ text:
141141
args:
142142
pdl_context: []
143143
plan: ${ plan }
144-
max_iterations: ${ N }
144+
maxIterations: ${ N }
145145
join:
146146
as: array
147147
join:
148148
as: array
149-
max_iterations: ${ MAX_ITERATIONS }
149+
maxIterations: ${ MAX_ITERATIONS }
150150
def: solutions
151151
join:
152152
as: array
@@ -164,12 +164,12 @@ text:
164164
args:
165165
pdl_context: []
166166
solution: ${ solution_for_problem }
167-
max_iterations: ${ N }
167+
maxIterations: ${ N }
168168
join:
169169
as: array
170170
join:
171171
as: array
172-
max_iterations: ${ MAX_ITERATIONS }
172+
maxIterations: ${ MAX_ITERATIONS }
173173
def: results
174174
join:
175175
as: array
@@ -184,10 +184,10 @@ text:
184184
args:
185185
pdl_context: []
186186
results: ${ results_for_problem }
187-
max_iterations: ${ N }
187+
maxIterations: ${ N }
188188
join:
189189
as: array
190-
max_iterations: ${ MAX_ITERATIONS }
190+
maxIterations: ${ MAX_ITERATIONS }
191191
def: per_plan_votes
192192
join:
193193
as: array
@@ -199,7 +199,7 @@ text:
199199
args:
200200
pdl_context: []
201201
numbers: ${ votes }
202-
max_iterations: ${ MAX_ITERATIONS }
202+
maxIterations: ${ MAX_ITERATIONS }
203203
join:
204204
as: array
205205
def: results
@@ -213,7 +213,7 @@ text:
213213
pdl_context: []
214214
result: ${ result }
215215
truth: ${ problem.answer }
216-
max_iterations: ${ MAX_ITERATIONS }
216+
maxIterations: ${ MAX_ITERATIONS }
217217
def: stats
218218
join:
219219
as: array

examples/gsm8k/gsm8k-tot-multiplan.pdl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ text:
9696
args:
9797
pdl_context: []
9898
problem: ${ problem.question }
99-
max_iterations: ${ N }
99+
maxIterations: ${ N }
100100
join:
101101
as: array
102-
max_iterations: ${ MAX_ITERATIONS }
102+
maxIterations: ${ MAX_ITERATIONS }
103103
def: plans
104104
join:
105105
as: array
@@ -116,7 +116,7 @@ text:
116116
plan: ${ plan }
117117
join:
118118
as: array
119-
max_iterations: ${ MAX_ITERATIONS }
119+
maxIterations: ${ MAX_ITERATIONS }
120120
def: solutions
121121
join:
122122
as: array
@@ -133,7 +133,7 @@ text:
133133
solution: ${ solution_for_problem }
134134
join:
135135
as: array
136-
max_iterations: ${ MAX_ITERATIONS }
136+
maxIterations: ${ MAX_ITERATIONS }
137137
def: results
138138
join:
139139
as: array
@@ -145,7 +145,7 @@ text:
145145
args:
146146
pdl_context: []
147147
results: ${ results_for_problem }
148-
max_iterations: ${ MAX_ITERATIONS }
148+
maxIterations: ${ MAX_ITERATIONS }
149149
def: votes
150150
join:
151151
as: array
@@ -159,7 +159,7 @@ text:
159159
pdl_context: []
160160
result: ${ result }
161161
truth: ${ problem.answer }
162-
max_iterations: ${ MAX_ITERATIONS }
162+
maxIterations: ${ MAX_ITERATIONS }
163163
def: stats
164164
join:
165165
as: array

examples/gsm8k/gsm8k-tot.pdl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ text:
109109
args:
110110
pdl_context: []
111111
problem: ${ problem.question }
112-
max_iterations: ${ N }
112+
maxIterations: ${ N }
113113
join:
114114
as: array
115-
max_iterations: ${ MAX_ITERATIONS }
115+
maxIterations: ${ MAX_ITERATIONS }
116116
def: plans
117117
join:
118118
as: array
@@ -128,12 +128,12 @@ text:
128128
args:
129129
pdl_context: []
130130
plan: ${ plan }
131-
max_iterations: ${ N }
131+
maxIterations: ${ N }
132132
join:
133133
as: array
134134
join:
135135
as: array
136-
max_iterations: ${ MAX_ITERATIONS }
136+
maxIterations: ${ MAX_ITERATIONS }
137137
def: solutions
138138
join:
139139
as: array
@@ -151,12 +151,12 @@ text:
151151
args:
152152
pdl_context: []
153153
solution: ${ solution_for_problem }
154-
max_iterations: ${ N }
154+
maxIterations: ${ N }
155155
join:
156156
as: array
157157
join:
158158
as: array
159-
max_iterations: ${ MAX_ITERATIONS }
159+
maxIterations: ${ MAX_ITERATIONS }
160160
def: results
161161
join:
162162
as: array
@@ -171,10 +171,10 @@ text:
171171
args:
172172
pdl_context: []
173173
results: ${ results_for_problem }
174-
max_iterations: ${ N }
174+
maxIterations: ${ N }
175175
join:
176176
as: array
177-
max_iterations: ${ MAX_ITERATIONS }
177+
maxIterations: ${ MAX_ITERATIONS }
178178
def: per_plan_votes
179179
join:
180180
as: array
@@ -186,7 +186,7 @@ text:
186186
args:
187187
pdl_context: []
188188
numbers: ${ votes }
189-
max_iterations: ${ MAX_ITERATIONS }
189+
maxIterations: ${ MAX_ITERATIONS }
190190
join:
191191
as: array
192192
def: results
@@ -200,7 +200,7 @@ text:
200200
pdl_context: []
201201
result: ${ result }
202202
truth: ${ problem.answer }
203-
max_iterations: ${ MAX_ITERATIONS }
203+
maxIterations: ${ MAX_ITERATIONS }
204204
def: stats
205205
join:
206206
as: array

examples/skeleton-of-thought/tips.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ text:
5858
pdl_context: []
5959
join:
6060
as: array
61-
max_iterations: ${ MAX_ITERATIONS }
61+
maxIterations: ${ MAX_ITERATIONS }
6262
def: skeletons
6363
- "\n\n"
6464
- for:

examples/tutorial/loop_index.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
index: i
22
repeat:
33
text: ${i + 1}
4-
max_iterations: 3
4+
maxIterations: 3

examples/tutorial/repeat.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ index: i
1111
repeat:
1212
"${i}: ${ name }'s number is ${ number }\n"
1313
until: ${ name == "Carol"}
14-
max_iterations: 3
14+
maxIterations: 3

pdl-live-react/src/pdl_ast.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ export type Until = LocalizedExpression | boolean | string
15101510
* Maximal number of iterations to perform.
15111511
*
15121512
*/
1513-
export type MaxIterations = LocalizedExpression | number | string | null
1513+
export type Maxiterations = LocalizedExpression | number | string | null
15141514
/**
15151515
* Define how to combine the result of each iteration.
15161516
*
@@ -3806,7 +3806,7 @@ export interface Defs9 {
38063806
* Bounded loop:
38073807
* ```PDL
38083808
* index: i
3809-
* max_iterations: 5
3809+
* maxIterations: 5
38103810
* repeat:
38113811
* ${ i }
38123812
* join:
@@ -3859,7 +3859,7 @@ export interface RepeatBlock {
38593859
while?: While
38603860
repeat: Repeat
38613861
until?: Until
3862-
max_iterations?: MaxIterations
3862+
maxIterations?: Maxiterations
38633863
join?: Join
38643864
pdl__trace?: PdlTrace2
38653865
}

0 commit comments

Comments
 (0)