Is there a way to pipe the answer of an agent to a question, inside the text of another question? #897
-
Qualtrics has a useful feature when the answer of a participant can be piped into subsequent question text. q_mostRecentGame = QuestionFreeText(
question_name="mostRecentGame",
question_text="What is the name of the game you most recently played?\n\nThis text will be copied into certain other questions, so please write only the game name and use abbreviations if needed."
)
q_bangs_1 = QuestionLinearScale(
question_name="bangs_1",
question_text="In my most recent session of {{mostRecentGame}}... I could play in the way I wanted.",
question_options=[1, 2, 3, 4, 5, 6, 7],
option_labels={1: "Strongly Disagree", 7: "Strongly Agree"}
) |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 2 replies
-
It can! https://docs.expectedparrot.com/en/latest/surveys.html#id2 |
Beta Was this translation helpful? Give feedback.
-
I think I'm doing something wrong with it... as I'm getting "jinja2.exceptions.UndefinedError: 'mostRecentGame' is undefined" Current implementation q_mostRecentGame = QuestionFreeText(
question_name="mostRecentGame",
question_text="What is the name of the game you most recently played?\n\nThis text will be copied into certain other questions, so please write only the game name and use abbreviations if needed."
)
q_bangs_1 = QuestionLinearScale(
question_name="bangs_1",
question_text="In my most recent session of {{ mostRecentGame.answer }}... I could play in the way I wanted.",
question_options=[1, 2, 3, 4, 5, 6, 7],
option_labels={1: "Strongly Disagree", 7: "Strongly Agree"}
)
survey = Survey(questions = [
q_played24hr,
q_socialGaming,
q_mostRecentGame,
q_bangs_1,
q_bangs_2,
q_bangs_3,
q_bangs_4,
q_bangs_5,
q_bangs_6,
q_displacedActivity,
q_lifeSat,
q_affectiveValence,
q_bpnsfs_1,
q_bpnsfs_2,
q_bpnsfs_3,
q_bpnsfs_4,
q_bpnsfs_5,
q_bpnsfs_6,
q_sd_0,
q_sd_1_hour,
q_sd_1_minute,
q_sd_1_am_pm,
q_sd_2_hour,
q_sd_2_minute,
q_sd_2_am_pm,
q_sd_3,
q_sd_4_hour,
q_sd_4_minute,
q_sd_4_am_pm,
q_sd_5_hour,
q_sd_5_minute,
q_sd_5_am_pm,
q_sd_6,
#q_timeUse,
q_stress_argument,
q_howStress_arg,
q_stress_letpass,
q_howStress_letPass,
q_stress_school,
q_howStress_school,
q_stress_home,
q_howStress_home,
q_stress_discrim,
q_howStress_discrim,
q_stress_relative,
q_howStress_relative,
q_stress_other,
q_howStress_other
])
from edsl import Model
Model.available()
model = Model("gpt-4o-mini")
model.parameters['temperature'] = 0.7
#%%
survey_full_1= survey.set_lagged_memory(6)
results = survey_full_1.by(agents_list).by(model).run(progress_bar=True)
|
Beta Was this translation helpful? Give feedback.
-
I am not able to reproduce this error with this code but I do not have the agents -- could you please share those details? |
Beta Was this translation helpful? Give feedback.
-
Notebook I'm running to try to reproduce: https://www.expectedparrot.com/content/6e0d1624-1062-4890-86c8-7b13628771ed |
Beta Was this translation helpful? Give feedback.
-
Ok I have reproduced the error (notebook is updated) -- it is a bug that occurs where there are questions after the questions that takes a piped answer: This works fine:
This will generate the error:
|
Beta Was this translation helpful? Give feedback.
-
THANK YOU @andreifoldes ! |
Beta Was this translation helpful? Give feedback.
-
I will get started on a fix ASAP - thanks for reporting @andreifoldes ! |
Beta Was this translation helpful? Give feedback.
-
Ok, candidate fix is here: #899 |
Beta Was this translation helpful? Give feedback.
It can! https://docs.expectedparrot.com/en/latest/surveys.html#id2
cc: @rbyh