Skip to content

Commit

Permalink
Fix role nested next node
Browse files Browse the repository at this point in the history
  • Loading branch information
slundberg committed May 22, 2023
1 parent 39b3d6a commit 0bc0be1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions guidance/_program_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ def update_return_value(s):
"block_content": self.block_content[-1],
"partial_output": self.extend_prefix,
"parser_node": node,
"block_close_node": node.children[-1],
"next_node": next_node,
"next_next_node": next_next_node,
"prev_node": node.children[0]
Expand Down
4 changes: 2 additions & 2 deletions guidance/library/_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ async def role(name, hidden=False, _parser_context=None):

out = await parser.visit(
block_content[0],
next_node=_parser_context["next_node"],
next_node=_parser_context["block_close_node"],
prev_node=_parser_context["prev_node"],
next_next_node=_parser_context["next_next_node"]
next_next_node=_parser_context["next_node"]
)

# send the role-end special tokens
Expand Down

0 comments on commit 0bc0be1

Please sign in to comment.