-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7662f37
commit 72cd435
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
docassemble/ALToolbox/data/questions/extract_fields_demo.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
modules: | ||
- .llms | ||
--- | ||
mandatory: True | ||
code: | | ||
intro | ||
try_defining_fields | ||
ending_screen | ||
--- | ||
code: | | ||
answers = extract_fields_from_text( | ||
initial_answer, | ||
field_list = [ | ||
'name', | ||
'age', | ||
'favorite_color', | ||
'favorite_food', | ||
'favorite_animal', | ||
'favorite_movie' | ||
], | ||
) | ||
define_fields_from_dict(answers) | ||
try_defining_fields = True | ||
--- | ||
continue button field: intro | ||
question: | | ||
Tell us why you are here | ||
subquestion: | | ||
This is a demonstration of the `extract_fields_from_text` function. | ||
We will look through your response and try to define some fields in advance. | ||
If the fields can be defined, we'll ask some follow-up questions. | ||
We'll try to define the following fields: | ||
* Your name | ||
* Your age | ||
* Your favorite color | ||
* Your favorite food | ||
* Your favorite animal | ||
* Your favorite movie | ||
We'll also ask you to tell us a little bit about yourself. | ||
fields: | ||
- Go ahead and give us a long narrative response: initial_answer | ||
datatype: area | ||
--- | ||
question: | | ||
How old are you? | ||
fields: | ||
- Your age: age | ||
datatype: integer | ||
--- | ||
question: | | ||
What is your name? | ||
fields: | ||
- Your name: name | ||
--- | ||
question: | | ||
What is your favorite color? | ||
fields: | ||
- Your favorite color: favorite_color | ||
--- | ||
question: | | ||
What is your favorite food? | ||
fields: | ||
- Your favorite food: favorite_food | ||
--- | ||
question: | | ||
What is your favorite animal? | ||
fields: | ||
- Your favorite animal: favorite_animal | ||
--- | ||
question: | | ||
What is your favorite movie? | ||
fields: | ||
- Your favorite movie: favorite_movie | ||
--- | ||
question: | | ||
Tell us a little bit about yourself | ||
fields: | ||
- Your response: final_answer | ||
datatype: area | ||
--- | ||
event: ending_screen | ||
question: | | ||
Here is what we learned about you | ||
subquestion: | | ||
Your name is ${ name }. | ||
You are ${ age } years old. | ||
Your favorite color is ${ favorite_color }. | ||
Your favorite food is ${ favorite_food }. | ||
Your favorite animal is ${ favorite_animal }. | ||
Your favorite movie is ${ favorite_movie }. | ||
You told us the following about yourself: | ||
${ final_answer } | ||
Thanks for participating! |