Skip to content

Commit

Permalink
use of match in react/demo example
Browse files Browse the repository at this point in the history
Signed-off-by: Mandana Vaziri <[email protected]>
  • Loading branch information
vazirim committed Feb 6, 2025
1 parent 33fe9f7 commit 38df8ac
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions examples/react/demo.pdl
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,25 @@ text:
parameters:
stop_sequences: "\n"
parser: json
- if: ${ action[0].name == 'Search' }
then:
text:
- "\nObs: "
- lang: python
code: |
import warnings, wikipedia
warnings.simplefilter("ignore")
try:
result = wikipedia.summary("${ action[0].arguments.topic }")
except wikipedia.WikipediaException as e:
result = str(e)
- "\n"
else:
if: ${ action[0].name == "Calc" }
then:
text:
- "\nObs: "
- lang: python
code: result = ${ action[0].arguments.expr }
- "\n"
until: ${ action[0].name == "Finish" }

- match: ${ action[0].name }
with:
- case: 'Search'
then:
text:
- "\nObs: "
- lang: python
code: |
import warnings, wikipedia
warnings.simplefilter("ignore")
try:
result = wikipedia.summary("${ action[0].arguments.topic }")
except wikipedia.WikipediaException as e:
result = str(e)
- case: 'Calc'
then:
text:
- "\nObs: "
- lang: python
code: result = ${ action[0].arguments.expr }
- "\n"
until: ${ action[0].name == "Finish" }

0 comments on commit 38df8ac

Please sign in to comment.