@@ -122,7 +122,7 @@ def __init__(
122122 self .message = message
123123
124124
125- empty_scope : ScopeType = {"context " : []}
125+ empty_scope : ScopeType = {"pdl_context " : []}
126126
127127
128128class InterpreterState (BaseModel ):
@@ -288,12 +288,12 @@ def step_block(
288288 yield YieldBackgroundMessage (background )
289289 if state .yield_result :
290290 yield YieldResultMessage (result )
291- append_log (state , "Context " , background )
291+ append_log (state , "pdl_context " , background )
292292 else :
293293 result , background , scope , trace = yield from step_advanced_block (
294294 state , scope , block , loc
295295 )
296- scope = scope | {"context " : background }
296+ scope = scope | {"pdl_context " : background }
297297 return result , background , scope , trace
298298
299299
@@ -516,7 +516,7 @@ def step_block_body(
516516 results = []
517517 background = []
518518 iterations_trace : list [BlocksType ] = []
519- context_init = scope_init ["context " ]
519+ pdl_context_init = scope_init ["pdl_context " ]
520520 iteration_state = state .with_yield_result (
521521 state .yield_result and block .join .iteration_type == IterationType .TEXT
522522 )
@@ -536,7 +536,7 @@ def step_block_body(
536536 [{"role" : block .role , "content" : join_string }]
537537 )
538538 scope = scope | {
539- "context " : messages_concat (context_init , background )
539+ "pdl_context " : messages_concat (pdl_context_init , background )
540540 }
541541 (
542542 iteration_result ,
@@ -569,7 +569,7 @@ def step_block_body(
569569 results = []
570570 background = []
571571 iter_trace : list [BlocksType ] = []
572- context_init = scope_init ["context " ]
572+ pdl_context_init = scope_init ["pdl_context " ]
573573 items , block = process_expr_of (block , "fors" , scope , loc , "for" )
574574 lengths = []
575575 for idx , lst in items .items ():
@@ -613,7 +613,7 @@ def step_block_body(
613613 [{"role" : block .role , "content" : join_string }]
614614 )
615615 scope = scope | {
616- "context " : messages_concat (context_init , background )
616+ "pdl_context " : messages_concat (pdl_context_init , background )
617617 }
618618 for k in items .keys ():
619619 scope = scope | {k : items [k ][i ]}
@@ -649,7 +649,7 @@ def step_block_body(
649649 stop = False
650650 background = []
651651 iterations_trace = []
652- context_init = scope_init ["context " ]
652+ pdl_context_init = scope_init ["pdl_context " ]
653653 iteration_state = state .with_yield_result (
654654 state .yield_result and block .join .iteration_type == IterationType .TEXT
655655 )
@@ -669,7 +669,7 @@ def step_block_body(
669669 [{"role" : block .role , "content" : join_string }]
670670 )
671671 scope = scope | {
672- "context " : messages_concat (context_init , background )
672+ "pdl_context " : messages_concat (pdl_context_init , background )
673673 }
674674 (
675675 iteration_result ,
@@ -806,10 +806,12 @@ def step_blocks(
806806 new_loc = None
807807 background = []
808808 trace = []
809- context_init = scope ["context " ]
809+ pdl_context_init = scope ["pdl_context " ]
810810 try :
811811 for i , block in enumerate (blocks ):
812- scope = scope | {"context" : messages_concat (context_init , background )}
812+ scope = scope | {
813+ "pdl_context" : messages_concat (pdl_context_init , background )
814+ }
813815 new_loc = append (loc , "[" + str (i ) + "]" )
814816 if iteration_type == IterationType .LASTOF and state .yield_result :
815817 iteration_state = state .with_yield_result (i + 1 == len (blocks ))
@@ -1029,7 +1031,7 @@ def step_call_model(
10291031 else :
10301032 model_input = model_input_result
10311033 else :
1032- model_input = scope ["context " ]
1034+ model_input = scope ["pdl_context " ]
10331035 input_trace = None
10341036 concrete_block = concrete_block .model_copy (
10351037 update = {
@@ -1294,7 +1296,7 @@ def step_call(
12941296 trace = block .model_copy (),
12951297 )
12961298 f_body = closure .returns
1297- f_scope = closure .scope | {"context " : scope ["context " ]} | args
1299+ f_scope = closure .scope | {"pdl_context " : scope ["pdl_context " ]} | args
12981300 fun_loc = LocationType (
12991301 file = closure .location .file ,
13001302 path = closure .location .path + ["return" ],
0 commit comments